sovereign 0.24.3__py3-none-any.whl → 0.24.4__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.
Potentially problematic release.
This version of sovereign might be problematic. Click here for more details.
- sovereign/context.py +15 -11
- {sovereign-0.24.3.dist-info → sovereign-0.24.4.dist-info}/METADATA +1 -1
- {sovereign-0.24.3.dist-info → sovereign-0.24.4.dist-info}/RECORD +6 -6
- {sovereign-0.24.3.dist-info → sovereign-0.24.4.dist-info}/LICENSE.txt +0 -0
- {sovereign-0.24.3.dist-info → sovereign-0.24.4.dist-info}/WHEEL +0 -0
- {sovereign-0.24.3.dist-info → sovereign-0.24.4.dist-info}/entry_points.txt +0 -0
sovereign/context.py
CHANGED
|
@@ -25,6 +25,7 @@ from sovereign.utils.timer import poll_forever, poll_forever_cron
|
|
|
25
25
|
class LoadContextResponse(NamedTuple):
|
|
26
26
|
context_name: str
|
|
27
27
|
context: Dict[str, Any]
|
|
28
|
+
success: bool = True
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class TemplateContext:
|
|
@@ -52,7 +53,8 @@ class TemplateContext:
|
|
|
52
53
|
self.logger = logger
|
|
53
54
|
self.stats = stats
|
|
54
55
|
# initial load
|
|
55
|
-
self.context =
|
|
56
|
+
self.context: Dict[str, Any] = {}
|
|
57
|
+
asyncio.run(self.load_context_variables())
|
|
56
58
|
|
|
57
59
|
async def start_refresh_context(self) -> NoReturn:
|
|
58
60
|
if self.refresh_cron is not None:
|
|
@@ -63,7 +65,7 @@ class TemplateContext:
|
|
|
63
65
|
raise RuntimeError("Failed to start refresh_context, this should never happen")
|
|
64
66
|
|
|
65
67
|
async def refresh_context(self) -> None:
|
|
66
|
-
|
|
68
|
+
await self.load_context_variables()
|
|
67
69
|
|
|
68
70
|
async def _load_context(
|
|
69
71
|
self,
|
|
@@ -96,13 +98,11 @@ class TemplateContext:
|
|
|
96
98
|
"context.refresh.error",
|
|
97
99
|
tags=[f"context:{context_name}"],
|
|
98
100
|
)
|
|
99
|
-
return LoadContextResponse(context_name, context_response)
|
|
101
|
+
return LoadContextResponse(context_name, context_response, False)
|
|
100
102
|
else:
|
|
101
103
|
await asyncio.sleep(refresh_retry_interval_secs)
|
|
102
104
|
|
|
103
|
-
async def load_context_variables(self) ->
|
|
104
|
-
context_response: Dict[str, Any] = dict()
|
|
105
|
-
|
|
105
|
+
async def load_context_variables(self) -> None:
|
|
106
106
|
context_coroutines: list[Awaitable[LoadContextResponse]] = []
|
|
107
107
|
for context_name, context_config in self.configured_context.items():
|
|
108
108
|
context_coroutines.append(
|
|
@@ -117,12 +117,16 @@ class TemplateContext:
|
|
|
117
117
|
context_results: list[LoadContextResponse] = await asyncio.gather(
|
|
118
118
|
*context_coroutines
|
|
119
119
|
)
|
|
120
|
-
for context_result in context_results:
|
|
121
|
-
context_response[context_result.context_name] = context_result.context
|
|
122
120
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
for context_result in context_results:
|
|
122
|
+
if (
|
|
123
|
+
context_result.success
|
|
124
|
+
or context_result.context_name not in self.context
|
|
125
|
+
):
|
|
126
|
+
self.context[context_result.context_name] = context_result.context
|
|
127
|
+
|
|
128
|
+
if "crypto" not in self.context and self.crypto:
|
|
129
|
+
self.context["crypto"] = self.crypto
|
|
126
130
|
|
|
127
131
|
def build_new_context_from_instances(self, node_value: str) -> Dict[str, Any]:
|
|
128
132
|
matches = self.poller.match_node(node_value=node_value)
|
|
@@ -3,7 +3,7 @@ sovereign/app.py,sha256=uozeEQJjefBUV6dZfIooTBJgDhEE4bd2ozRxWVdVMK4,4085
|
|
|
3
3
|
sovereign/config_loader.py,sha256=ZLKlyuvJ8Wqhsg6xZI-zp_5ABslB3Tc9zEdpds7-d7Q,6349
|
|
4
4
|
sovereign/configuration.py,sha256=rpZWNgn5ySNO1bdHlUix02yzo3wOefJaWkif5_4HjyE,2665
|
|
5
5
|
sovereign/constants.py,sha256=qdWD1lTvkaW5JGF7TmZhfksQHlRAJFVqbG7v6JQA9k8,46
|
|
6
|
-
sovereign/context.py,sha256=
|
|
6
|
+
sovereign/context.py,sha256=dsKEUK7yrOpXGMY_YzxuaoBDmGXIh0fvtVBoh3Dd8SY,6509
|
|
7
7
|
sovereign/discovery.py,sha256=TPecAoUDHx6SbS5hE2K73uEgDro0Uzz3qsvOQMpFtGI,5899
|
|
8
8
|
sovereign/error_info.py,sha256=r2KXBYq9Fo7AI2pmIpATWFm0pykr2MqfrKH0WWW5Sfk,1488
|
|
9
9
|
sovereign/logging/access_logger.py,sha256=JMMzQvi7doFJGA__YYqyasdfAT9W31Ycu_oZ2ovAMis,2565
|
|
@@ -48,8 +48,8 @@ sovereign/views/crypto.py,sha256=nxp6bkPU9GZw_zOk0fsJdz_XRQPXxPI6cXQDL9-cigU,204
|
|
|
48
48
|
sovereign/views/discovery.py,sha256=DzFfG8fdFHKAZzmWZi9YzFP2PYLCf3tPlEAY3udNyNg,5980
|
|
49
49
|
sovereign/views/healthchecks.py,sha256=_WkMunlrFpqGTLgtNtRr7gCsDCv5kiuYxCyTi-dMEKM,1357
|
|
50
50
|
sovereign/views/interface.py,sha256=Y2fbR26cSF8eKQHfTbnv5WKEdgqaGNwys0lEGUTjXqw,7041
|
|
51
|
-
sovereign-0.24.
|
|
52
|
-
sovereign-0.24.
|
|
53
|
-
sovereign-0.24.
|
|
54
|
-
sovereign-0.24.
|
|
55
|
-
sovereign-0.24.
|
|
51
|
+
sovereign-0.24.4.dist-info/LICENSE.txt,sha256=2X125zvAb9AYLjCgdMDQZuufhm0kwcg31A8pGKj_-VY,560
|
|
52
|
+
sovereign-0.24.4.dist-info/METADATA,sha256=LqqpmlxRdURu6o4bvIiNo_0_zOWbD4hWsck8Fpn0HDY,6420
|
|
53
|
+
sovereign-0.24.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
|
54
|
+
sovereign-0.24.4.dist-info/entry_points.txt,sha256=kOn848ucVbNvtsGABDuwzOHmNiOb0Ey8dV85Z3dLv3Y,222
|
|
55
|
+
sovereign-0.24.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|