stoobly-agent 0.34.9__py3-none-any.whl → 0.34.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/api/proxy_controller.py +12 -10
- stoobly_agent/app/cli/config_cli.py +5 -3
- stoobly_agent/app/cli/helpers/handle_config_update_service.py +5 -0
- stoobly_agent/app/cli/snapshot_cli.py +85 -6
- stoobly_agent/app/models/adapters/python/response/mitmproxy_adapter.py +1 -1
- stoobly_agent/app/models/factories/resource/local_db/helpers/log.py +9 -7
- stoobly_agent/app/models/factories/resource/local_db/helpers/request_snapshot.py +5 -0
- stoobly_agent/app/models/factories/resource/local_db/helpers/scenario_snapshot.py +24 -0
- stoobly_agent/app/models/factories/resource/local_db/helpers/snapshot.py +18 -2
- stoobly_agent/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request.py +6 -1
- stoobly_agent/app/models/factories/resource/local_db/query_param_adapter.py +9 -5
- stoobly_agent/app/models/factories/resource/local_db/request_adapter.py +1 -0
- stoobly_agent/app/proxy/handle_mock_service.py +16 -9
- stoobly_agent/app/proxy/handle_record_service.py +2 -2
- stoobly_agent/app/proxy/intercept_handler.py +7 -4
- stoobly_agent/app/proxy/mitmproxy/request_facade.py +4 -2
- stoobly_agent/app/proxy/mock/eval_fixtures_service.py +3 -1
- stoobly_agent/app/proxy/mock/hashed_request_decorator.py +10 -10
- stoobly_agent/app/proxy/mock/request_hasher.py +3 -1
- stoobly_agent/app/proxy/record/upload_request_service.py +5 -5
- stoobly_agent/app/proxy/replay/alias_resolver.py +5 -3
- stoobly_agent/app/proxy/replay/body_parser_service.py +1 -5
- stoobly_agent/app/proxy/replay/multipart.py +9 -27
- stoobly_agent/app/proxy/replay/trace_context.py +10 -9
- stoobly_agent/app/proxy/test/helpers/upload_test_service.py +5 -3
- stoobly_agent/app/proxy/utils/allowed_request_service.py +7 -5
- stoobly_agent/app/proxy/utils/request_handler.py +3 -1
- stoobly_agent/app/settings/__init__.py +32 -14
- stoobly_agent/cli.py +1 -1
- stoobly_agent/config/constants/custom_headers.py +1 -0
- stoobly_agent/config/data_dir.py +39 -21
- stoobly_agent/lib/api/body_param_names_resource.py +5 -3
- stoobly_agent/lib/api/endpoints_resource.py +5 -3
- stoobly_agent/lib/api/header_names_resource.py +5 -3
- stoobly_agent/lib/api/projects_resource.py +5 -3
- stoobly_agent/lib/api/query_param_names_resource.py +5 -3
- stoobly_agent/lib/api/requests_resource.py +5 -3
- stoobly_agent/lib/api/response_header_names_resource.py +5 -3
- stoobly_agent/lib/api/response_param_names_resource.py +5 -3
- stoobly_agent/lib/api/scenarios_resource.py +5 -3
- stoobly_agent/lib/api/stoobly_api.py +0 -1
- stoobly_agent/lib/api/test_responses_resource.py +3 -1
- stoobly_agent/lib/api/tests_resource.py +3 -1
- stoobly_agent/lib/api/users_resource.py +3 -1
- stoobly_agent/lib/cache.py +26 -9
- stoobly_agent/lib/logger.py +5 -2
- stoobly_agent/lib/utils/visitor.py +4 -3
- stoobly_agent/public/{13-es2015.220b4a1adf4cacb294e5.js → 13-es2015.343b0261a8b3b3f4a1fc.js} +1 -1
- stoobly_agent/public/{13-es5.220b4a1adf4cacb294e5.js → 13-es5.343b0261a8b3b3f4a1fc.js} +1 -1
- stoobly_agent/public/18-es2015.d3b430636a4d6f544d92.js +1 -0
- stoobly_agent/public/18-es5.d3b430636a4d6f544d92.js +1 -0
- stoobly_agent/public/35-es2015.f741ebce0bfc25f0ec99.js +1 -0
- stoobly_agent/public/35-es5.f741ebce0bfc25f0ec99.js +1 -0
- stoobly_agent/public/7-es2015.19ccb84e62e2ea874f53.js +1 -0
- stoobly_agent/public/7-es5.19ccb84e62e2ea874f53.js +1 -0
- stoobly_agent/public/9-es2015.b7bcad8238f58e214f03.js +1 -0
- stoobly_agent/public/9-es5.b7bcad8238f58e214f03.js +1 -0
- stoobly_agent/public/index.html +1 -1
- stoobly_agent/public/runtime-es2015.9addf49b79aca951b7e2.js +1 -0
- stoobly_agent/public/runtime-es5.9addf49b79aca951b7e2.js +1 -0
- stoobly_agent/test/app/cli/snapshot/snapshot_copy_test.py +56 -0
- stoobly_agent/test/app/cli/snapshot/snapshot_prune_test.py +2 -5
- stoobly_agent/test/app/cli/snapshot/snapshot_update_test.py +0 -1
- stoobly_agent/test/app/models/factories/resource/local_db/helpers/tiebreak_scenario_request_test.py +20 -2
- stoobly_agent/test/app/models/schemas/.stoobly/db/VERSION +1 -1
- stoobly_agent/test/app/proxy/replay/body_parser_service_test.py +3 -3
- stoobly_agent/test/config/data_dir_test.py +4 -2
- {stoobly_agent-0.34.9.dist-info → stoobly_agent-0.34.11.dist-info}/METADATA +2 -1
- {stoobly_agent-0.34.9.dist-info → stoobly_agent-0.34.11.dist-info}/RECORD +73 -72
- stoobly_agent/public/18-es2015.10cdd5c608b10d90d19a.js +0 -1
- stoobly_agent/public/18-es5.10cdd5c608b10d90d19a.js +0 -1
- stoobly_agent/public/35-es2015.61a7ae8da93df94fab06.js +0 -1
- stoobly_agent/public/35-es5.61a7ae8da93df94fab06.js +0 -1
- stoobly_agent/public/7-es2015.c359dbb640e2af507221.js +0 -1
- stoobly_agent/public/7-es5.c359dbb640e2af507221.js +0 -1
- stoobly_agent/public/9-es2015.cfc1101139d6ae75731b.js +0 -1
- stoobly_agent/public/9-es5.cfc1101139d6ae75731b.js +0 -1
- stoobly_agent/public/runtime-es2015.08e65883d390cd16c15b.js +0 -1
- stoobly_agent/public/runtime-es5.08e65883d390cd16c15b.js +0 -1
- {stoobly_agent-0.34.9.dist-info → stoobly_agent-0.34.11.dist-info}/LICENSE +0 -0
- {stoobly_agent-0.34.9.dist-info → stoobly_agent-0.34.11.dist-info}/WHEEL +0 -0
- {stoobly_agent-0.34.9.dist-info → stoobly_agent-0.34.11.dist-info}/entry_points.txt +0 -0
@@ -7,26 +7,28 @@ from ..logger import Logger
|
|
7
7
|
from .interfaces import ProjectCreateParams, ProjectsIndexQueryParams
|
8
8
|
from .stoobly_api import StooblyApi
|
9
9
|
|
10
|
+
LOG_ID = 'ProjectsResource'
|
11
|
+
|
10
12
|
class ProjectsResource(StooblyApi):
|
11
13
|
PROJECTS_ENDPOINT = 'projects'
|
12
14
|
|
13
15
|
def create(self, **params: ProjectCreateParams):
|
14
16
|
url = f"{self.service_url}/{self.PROJECTS_ENDPOINT}"
|
15
17
|
|
16
|
-
Logger.instance().debug(f"{
|
18
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(params)}")
|
17
19
|
|
18
20
|
return self.post(url, headers=self.default_headers, json=params)
|
19
21
|
|
20
22
|
def index(self, **query_params: ProjectsIndexQueryParams) -> requests.Response:
|
21
23
|
url = f"{self.service_url}/{self.PROJECTS_ENDPOINT}"
|
22
24
|
|
23
|
-
Logger.instance().debug(f"{
|
25
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
24
26
|
|
25
27
|
return self.get(url, headers=self.default_headers, params=query_params)
|
26
28
|
|
27
29
|
def show(self, project_id: int, **query_params) -> requests.Response:
|
28
30
|
url = f"{self.service_url}/{self.PROJECTS_ENDPOINT}/{project_id}"
|
29
31
|
|
30
|
-
Logger.instance().debug(f"{
|
32
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
31
33
|
|
32
34
|
return self.get(url, headers=self.default_headers, params=query_params)
|
@@ -7,6 +7,8 @@ from stoobly_agent.app.models.types import ParamNameCreateParams
|
|
7
7
|
from ..logger import Logger
|
8
8
|
from .endpoints_resource import EndpointsResource
|
9
9
|
|
10
|
+
LOG_ID = 'QueryParamNamesResource'
|
11
|
+
|
10
12
|
class QueryParamNamesResource(EndpointsResource):
|
11
13
|
QUERY_PARAM_NAMES_ENDPOINT = 'query_param_names'
|
12
14
|
|
@@ -17,20 +19,20 @@ class QueryParamNamesResource(EndpointsResource):
|
|
17
19
|
def index(self, endpoint_id: int, query_params = {}) -> requests.Response:
|
18
20
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.QUERY_PARAM_NAMES_ENDPOINT}"
|
19
21
|
|
20
|
-
Logger.instance().debug(f"{
|
22
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
21
23
|
|
22
24
|
return self.get(url, headers=self.default_headers, params=query_params)
|
23
25
|
|
24
26
|
def show(self, endpoint_id: int, query_param_name_id: int, query_params = {}) -> requests.Response:
|
25
27
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.QUERY_PARAM_NAMES_ENDPOINT}/{query_param_name_id}"
|
26
28
|
|
27
|
-
Logger.instance().debug(f"{
|
29
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
28
30
|
|
29
31
|
return self.get(url, headers=self.default_headers, params=query_params)
|
30
32
|
|
31
33
|
def destroy(self, endpoint_id: int, query_param_name_id: int, query_params = {}) -> requests.Response:
|
32
34
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.QUERY_PARAM_NAMES_ENDPOINT}/{query_param_name_id}"
|
33
35
|
|
34
|
-
Logger.instance().debug(f"{
|
36
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
35
37
|
|
36
38
|
return self.delete(url, headers=self.default_headers, params=query_params)
|
@@ -5,6 +5,8 @@ from ..logger import Logger
|
|
5
5
|
from .interfaces import RequestCreateParams, RequestsIndexQueryParams, RequestShowQueryParams
|
6
6
|
from .stoobly_api import StooblyApi
|
7
7
|
|
8
|
+
LOG_ID = 'RequestsResource'
|
9
|
+
|
8
10
|
class RequestsResource(StooblyApi):
|
9
11
|
|
10
12
|
def create(self, **body_params: RequestCreateParams):
|
@@ -22,14 +24,14 @@ class RequestsResource(StooblyApi):
|
|
22
24
|
def index(self, **query_params: RequestsIndexQueryParams):
|
23
25
|
url = f"{self.service_url}{self.REQUESTS_ENDPOINT}"
|
24
26
|
|
25
|
-
Logger.instance().debug(f"{
|
27
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
26
28
|
|
27
29
|
return self.get(url, headers=self.default_headers, params=query_params)
|
28
30
|
|
29
31
|
def response(self, **query_params):
|
30
32
|
url = f"{self.service_url}{self.REQUESTS_ENDPOINT}/response"
|
31
33
|
|
32
|
-
Logger.instance().debug(f"{
|
34
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
33
35
|
|
34
36
|
return self.get(
|
35
37
|
url,
|
@@ -42,7 +44,7 @@ class RequestsResource(StooblyApi):
|
|
42
44
|
def show(self, request_id, **query_params: RequestShowQueryParams):
|
43
45
|
url = f"{self.service_url}{self.REQUESTS_ENDPOINT}/{request_id}"
|
44
46
|
|
45
|
-
Logger.instance().debug(f"{
|
47
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
46
48
|
|
47
49
|
return self.get(url, headers=self.default_headers, params=query_params)
|
48
50
|
|
@@ -7,6 +7,8 @@ from stoobly_agent.app.models.types import HeaderNameCreateParams
|
|
7
7
|
from ..logger import Logger
|
8
8
|
from .endpoints_resource import EndpointsResource
|
9
9
|
|
10
|
+
LOG_ID = 'ResponseHeaderNamesResource'
|
11
|
+
|
10
12
|
class ResponseHeaderNamesResource(EndpointsResource):
|
11
13
|
RESPONSE_HEADER_NAME_ENDPOINT = 'response_header_names'
|
12
14
|
|
@@ -17,20 +19,20 @@ class ResponseHeaderNamesResource(EndpointsResource):
|
|
17
19
|
def index(self, endpoint_id: int, query_params = {}) -> requests.Response:
|
18
20
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_HEADER_NAME_ENDPOINT}"
|
19
21
|
|
20
|
-
Logger.instance().debug(f"{
|
22
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
21
23
|
|
22
24
|
return self.get(url, headers=self.default_headers, params=query_params)
|
23
25
|
|
24
26
|
def show(self, endpoint_id: int, response_header_name_id: int, query_params = {}) -> requests.Response:
|
25
27
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_HEADER_NAME_ENDPOINT}/{response_header_name_id}"
|
26
28
|
|
27
|
-
Logger.instance().debug(f"{
|
29
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
28
30
|
|
29
31
|
return self.get(url, headers=self.default_headers, params=query_params)
|
30
32
|
|
31
33
|
def destroy(self, endpoint_id: int, response_header_name_id: int, query_params = {}) -> requests.Response:
|
32
34
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_HEADER_NAME_ENDPOINT}/{response_header_name_id}"
|
33
35
|
|
34
|
-
Logger.instance().debug(f"{
|
36
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
35
37
|
|
36
38
|
return self.delete(url, headers=self.default_headers, params=query_params)
|
@@ -7,6 +7,8 @@ from stoobly_agent.app.models.types import ParamNameCreateParams
|
|
7
7
|
from ..logger import Logger
|
8
8
|
from .endpoints_resource import EndpointsResource
|
9
9
|
|
10
|
+
LOG_ID = 'ResponseParamNamesResource'
|
11
|
+
|
10
12
|
class ResponseParamNamesResource(EndpointsResource):
|
11
13
|
RESPONSE_PARAM_NAMES_ENDPOINT = 'response_param_names'
|
12
14
|
|
@@ -17,20 +19,20 @@ class ResponseParamNamesResource(EndpointsResource):
|
|
17
19
|
def index(self, endpoint_id: int, query_params = {}) -> requests.Response:
|
18
20
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_PARAM_NAMES_ENDPOINT}"
|
19
21
|
|
20
|
-
Logger.instance().debug(f"{
|
22
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
21
23
|
|
22
24
|
return self.get(url, headers=self.default_headers, params=query_params)
|
23
25
|
|
24
26
|
def show(self, endpoint_id: int, response_param_name_id: int, query_params = {}) -> requests.Response:
|
25
27
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_PARAM_NAMES_ENDPOINT}/{response_param_name_id}"
|
26
28
|
|
27
|
-
Logger.instance().debug(f"{
|
29
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
28
30
|
|
29
31
|
return self.get(url, headers=self.default_headers, params=query_params)
|
30
32
|
|
31
33
|
def destroy(self, endpoint_id: int, response_param_name_id: int, query_params = {}) -> requests.Response:
|
32
34
|
url = f"{self.service_url}/{self.ENDPOINTS_ENDPOINT}/{endpoint_id}/{self.RESPONSE_PARAM_NAMES_ENDPOINT}/{response_param_name_id}"
|
33
35
|
|
34
|
-
Logger.instance().debug(f"{
|
36
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
35
37
|
|
36
38
|
return self.delete(url, headers=self.default_headers, params=query_params)
|
@@ -7,6 +7,8 @@ from ..logger import Logger
|
|
7
7
|
from .interfaces.pagination_query_params import PaginationQueryParams
|
8
8
|
from .stoobly_api import StooblyApi
|
9
9
|
|
10
|
+
LOG_ID = 'ScenariosResource'
|
11
|
+
|
10
12
|
class ScenariosResource(StooblyApi):
|
11
13
|
SCENARIOS_ENDPOINT = 'scenarios'
|
12
14
|
|
@@ -17,20 +19,20 @@ class ScenariosResource(StooblyApi):
|
|
17
19
|
def index(self, **query_params: PaginationQueryParams) -> requests.Response:
|
18
20
|
url = f"{self.service_url}/{self.SCENARIOS_ENDPOINT}"
|
19
21
|
|
20
|
-
Logger.instance().debug(f"{
|
22
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
21
23
|
|
22
24
|
return self.get(url, headers=self.default_headers, params=query_params)
|
23
25
|
|
24
26
|
def show(self, scenario_id: int, **query_params) -> requests.Response:
|
25
27
|
url = f"{self.service_url}/{self.SCENARIOS_ENDPOINT}/{scenario_id}"
|
26
28
|
|
27
|
-
Logger.instance().debug(f"{
|
29
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
28
30
|
|
29
31
|
return self.get(url, headers=self.default_headers, params=query_params)
|
30
32
|
|
31
33
|
def update(self, scenario_id: int, **params):
|
32
34
|
url = f"{self.service_url}/{self.SCENARIOS_ENDPOINT}/{scenario_id}"
|
33
35
|
|
34
|
-
Logger.instance().debug(f"{
|
36
|
+
Logger.instance(LOG_ID).debug(f"{url}")
|
35
37
|
|
36
38
|
return self.put(url, headers=self.default_headers, json=params)
|
@@ -4,12 +4,14 @@ import urllib
|
|
4
4
|
from ..logger import Logger
|
5
5
|
from .tests_resource import TestsResource
|
6
6
|
|
7
|
+
LOG_ID = 'TestResponsesResource'
|
8
|
+
|
7
9
|
class TestResponsesResource(TestsResource):
|
8
10
|
RESPONSES_ENDPOINT = 'responses'
|
9
11
|
|
10
12
|
def mock(self, test_id: int, **query_params) -> requests.Response:
|
11
13
|
url = f"{self.service_url}/{self.TESTS_ENDPOINT}/{test_id}/{self.RESPONSES_ENDPOINT}/mock"
|
12
14
|
|
13
|
-
Logger.instance().debug(f"{
|
15
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
14
16
|
|
15
17
|
return self.get(url, headers=self.default_headers, params=query_params)
|
@@ -6,6 +6,8 @@ from stoobly_agent.lib.api.interfaces.tests import TestCreateParams
|
|
6
6
|
from ..logger import Logger
|
7
7
|
from .stoobly_api import StooblyApi
|
8
8
|
|
9
|
+
LOG_ID = 'TestsResource'
|
10
|
+
|
9
11
|
class TestsResource(StooblyApi):
|
10
12
|
TESTS_ENDPOINT = 'tests'
|
11
13
|
|
@@ -22,6 +24,6 @@ class TestsResource(StooblyApi):
|
|
22
24
|
def show(self, test_id: int, **query_params) -> requests.Response:
|
23
25
|
url = f"{self.service_url}/{self.TESTS_ENDPOINT}/{test_id}"
|
24
26
|
|
25
|
-
Logger.instance().debug(f"{
|
27
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
26
28
|
|
27
29
|
return self.get(url, headers=self.default_headers, params=query_params)
|
@@ -5,12 +5,14 @@ import pdb
|
|
5
5
|
from ..logger import Logger
|
6
6
|
from .stoobly_api import StooblyApi
|
7
7
|
|
8
|
+
LOG_ID = 'UsersResource'
|
9
|
+
|
8
10
|
class UsersResource(StooblyApi):
|
9
11
|
USERS_ENDPOINT = 'users'
|
10
12
|
|
11
13
|
def profile(self, query_params = {}) -> requests.Response:
|
12
14
|
url = f"{self.service_url}/{self.USERS_ENDPOINT}/profile"
|
13
15
|
|
14
|
-
Logger.instance().debug(f"{
|
16
|
+
Logger.instance(LOG_ID).debug(f"{url}?{urllib.parse.urlencode(query_params)}")
|
15
17
|
|
16
18
|
return self.get(url, headers=self.default_headers, params=query_params)
|
stoobly_agent/lib/cache.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import pdb
|
2
2
|
import random
|
3
|
+
import re
|
3
4
|
|
4
5
|
from time import time
|
5
6
|
|
@@ -23,10 +24,19 @@ class Cache:
|
|
23
24
|
|
24
25
|
return cls._instance
|
25
26
|
|
26
|
-
def clear(self):
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
def clear(self, pattern: str = None):
|
28
|
+
if not pattern:
|
29
|
+
self.data = {}
|
30
|
+
self.dataVersions = {}
|
31
|
+
self.version += 1
|
32
|
+
else:
|
33
|
+
delete_list = []
|
34
|
+
for key in self.data.keys():
|
35
|
+
if re.match(pattern, key):
|
36
|
+
delete_list.append(key)
|
37
|
+
|
38
|
+
for key in delete_list:
|
39
|
+
self.delete(key)
|
30
40
|
|
31
41
|
def read(self, key):
|
32
42
|
if key in self.timeouts:
|
@@ -48,9 +58,10 @@ class Cache:
|
|
48
58
|
|
49
59
|
def read_all(self):
|
50
60
|
data = []
|
51
|
-
|
52
|
-
for key in self.data.keys():
|
61
|
+
|
62
|
+
for key in list(self.data.keys()):
|
53
63
|
datum = self.read(key)
|
64
|
+
|
54
65
|
if datum:
|
55
66
|
data.append(datum)
|
56
67
|
|
@@ -73,7 +84,13 @@ class Cache:
|
|
73
84
|
self.version += 1
|
74
85
|
|
75
86
|
def delete(self, key):
|
76
|
-
|
77
|
-
|
78
|
-
|
87
|
+
if key in self.data:
|
88
|
+
del self.data[key]
|
89
|
+
|
90
|
+
if key in self.dataVersions:
|
91
|
+
del self.dataVersions[key]
|
92
|
+
|
93
|
+
if key in self.timeouts:
|
94
|
+
del self.timeouts[key]
|
95
|
+
|
79
96
|
self.version += 1
|
stoobly_agent/lib/logger.py
CHANGED
@@ -31,13 +31,16 @@ class Logger:
|
|
31
31
|
raise RuntimeError('Call instance() instead')
|
32
32
|
|
33
33
|
@classmethod
|
34
|
-
def instance(cls):
|
34
|
+
def instance(cls, name = None):
|
35
35
|
if cls._instance is None:
|
36
36
|
cls._instance = cls.__new__(cls)
|
37
37
|
|
38
38
|
cls._instance.load()
|
39
39
|
|
40
|
-
|
40
|
+
if not name:
|
41
|
+
return logging
|
42
|
+
else:
|
43
|
+
return logging.getLogger(name)
|
41
44
|
|
42
45
|
@classmethod
|
43
46
|
def reload(cls):
|
@@ -8,6 +8,7 @@ from jmespath.compat import string_type
|
|
8
8
|
from numbers import Number
|
9
9
|
from stoobly_agent.lib.logger import Logger
|
10
10
|
|
11
|
+
LOG_ID = 'JmesPath'
|
11
12
|
|
12
13
|
def _equals(x, y):
|
13
14
|
if _is_special_integer_case(x, y):
|
@@ -108,7 +109,7 @@ class Visitor(object):
|
|
108
109
|
|
109
110
|
def increment_visits(self, node):
|
110
111
|
self.visited_nodes.append(node)
|
111
|
-
Logger.instance().debug(f"{len(self.visited_nodes)} {node}")
|
112
|
+
Logger.instance(LOG_ID).debug(f"{len(self.visited_nodes)} {node}")
|
112
113
|
|
113
114
|
def build_traverse_path(self, node):
|
114
115
|
if len(self.nodes) > 0:
|
@@ -118,9 +119,9 @@ class Visitor(object):
|
|
118
119
|
|
119
120
|
self.build_traverse_path_traverse(node)
|
120
121
|
|
121
|
-
Logger.instance().debug('Traverse Path')
|
122
|
+
Logger.instance(LOG_ID).debug('Traverse Path')
|
122
123
|
for i, node in enumerate(self.nodes):
|
123
|
-
Logger.instance().debug(f"{i + 1} {node}")
|
124
|
+
Logger.instance(LOG_ID).debug(f"{i + 1} {node}")
|
124
125
|
|
125
126
|
def build_traverse_path_traverse(self, node):
|
126
127
|
if node['type'] == 'projection':
|