Skip to content

Commit 6c46801

Browse files
committed
Merge dev into main
2 parents 1690c17 + 1470ba9 commit 6c46801

File tree

7 files changed

+43
-33
lines changed

7 files changed

+43
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Repo details
44

5-
![Current Release](https://img.shields.io/badge/release-v0.3.0-blue)
5+
![Current Release](https://img.shields.io/badge/release-v0.3.1-blue)

osbot_local_stack/local_stack/Local_Stack.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from osbot_aws.aws.s3.S3 import S3
2-
from osbot_aws.AWS_Config import ENV_NAME__AWS_ENDPOINT_URL
31
from osbot_local_stack.local_stack.Local_Stack__Internal import Local_Stack__Internal, DEFAULT__LOCAL_STACK__TARGET_SERVER
4-
from osbot_utils.utils.Env import get_env, set_env, del_env
52
from osbot_utils.base_classes.Type_Safe import Type_Safe
63

74
class Local_Stack(Type_Safe):
@@ -18,12 +15,18 @@ def __exit__(self, exc_type, exc_val, exc_tb):
1815

1916

2017
def activate(self):
18+
from osbot_aws.AWS_Config import ENV_NAME__AWS_ENDPOINT_URL
19+
from osbot_utils.utils.Env import get_env, set_env
20+
2121
endpoint_url = self.local_stack__internal.endpoint_url
2222
self.endpoint_url__saved = get_env(ENV_NAME__AWS_ENDPOINT_URL)
2323
set_env(ENV_NAME__AWS_ENDPOINT_URL, endpoint_url)
2424
return self
2525

2626
def deactivate(self):
27+
from osbot_aws.AWS_Config import ENV_NAME__AWS_ENDPOINT_URL
28+
from osbot_utils.utils.Env import set_env, del_env
29+
2730
if self.endpoint_url__saved is None:
2831
del_env(ENV_NAME__AWS_ENDPOINT_URL)
2932
else:
@@ -34,6 +37,8 @@ def check__local_stack__health(self):
3437
return self.local_stack__internal.get__internal_health() != {}
3538

3639
def check__local_stack__boto3_setup(self):
40+
from osbot_aws.aws.s3.S3 import S3
41+
3742
return S3().client().meta.endpoint_url == DEFAULT__LOCAL_STACK__TARGET_SERVER # use S3 since this is the one that is currently working correctly
3843

3944
def is_local_stack_configured_and_available(self):

osbot_local_stack/local_stack/Local_Stack__Internal.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
import requests
2-
from requests import RequestException
3-
4-
from osbot_utils.utils.Objects import dict_to_obj
5-
6-
from osbot_utils.utils.Http import url_join_safe
7-
8-
from osbot_utils.utils.Env import get_env
9-
101
from osbot_utils.base_classes.Type_Safe import Type_Safe
112

123
ENV_NAME__LOCAL_STACK__TARGET_SERVER = 'LOCAL_STACK__TARGET_SERVER'
134
DEFAULT__LOCAL_STACK__TARGET_SERVER = 'http://localhost:4566'
145

156
# see full list at https://docs.localstack.cloud/references/internal-endpoints/
7+
168
class Local_Stack__Internal(Type_Safe):
17-
endpoint_url: str = get_env(ENV_NAME__LOCAL_STACK__TARGET_SERVER, DEFAULT__LOCAL_STACK__TARGET_SERVER)
9+
endpoint_url: str = None
10+
11+
def __init__(self, **kwargs):
12+
from osbot_utils.utils.Env import get_env
13+
14+
super().__init__(**kwargs)
15+
self.endpoint_url = get_env(ENV_NAME__LOCAL_STACK__TARGET_SERVER, DEFAULT__LOCAL_STACK__TARGET_SERVER)
1816

1917
def get__aws_lambda_runtimes(self):
2018
return self.requests__aws__get('lambda/runtimes')
@@ -40,6 +38,11 @@ def requests__internal__get(self, action):
4038
return self.requests__get(path)
4139

4240
def requests__get(self, path):
41+
import requests
42+
from requests import RequestException
43+
from osbot_utils.utils.Objects import dict_to_obj
44+
from osbot_utils.utils.Http import url_join_safe
45+
4346
try:
4447
url = url_join_safe(self.endpoint_url, path)
4548
json_data = requests.get(url).json()

osbot_local_stack/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.3.0
1+
v0.3.1

poetry.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "osbot_local_stack"
3-
version = "v0.3.0"
3+
version = "v0.3.1"
44
description = "OWASP Security Bot - LLM"
55
authors = ["Dinis Cruz <[email protected]>"]
66
license = "MIT"

tests/integration/local_stack/test_Local_Stack__Internal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ def test_get__internal_health(self):
3434
assert getattr(health.services, 'resource-groups') == 'disabled' # name has a - in it
3535
for service_name in expected_available_services:
3636
assert getattr(health.services,service_name) in ['available', 'running']
37-
assert health.version.startswith('3.8.') is True
37+
38+
#assert health.version.startswith('3.8.') is True
39+
3840
# skipping this since there were a couple inconsistencies in the data when running this in GH Actions
3941
#delattr(obj_data.services, 'lambda' )
4042
#delattr(obj_data.services, 'resource-groups')

0 commit comments

Comments
 (0)