Skip to content

Commit b3dbde1

Browse files
committed
Fix configurations
Signed-off-by: roeiK-wix <[email protected]>
1 parent aad77a1 commit b3dbde1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

chaoslib/configuration.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ def load_configuration(
6666
conf = {}
6767

6868
for (key, value) in config_info.items():
69+
# ----------------FIX----------------
70+
if extra_vars.get(key):
71+
value = extra_vars[key]
72+
del extra_vars[key]
73+
# ------------------------------------
6974
if isinstance(value, dict) and "type" in value:
7075
if value["type"] == "env":
7176
env_key = value["key"]
@@ -148,29 +153,28 @@ def load_dynamic_configuration(
148153
# from elsewhere
149154
from chaoslib.activity import run_activity
150155

151-
conf = {}
152156
secrets = secrets or {}
153157

154158
had_errors = False
155159
logger.debug("Loading dynamic configuration...")
156160
for (key, value) in config.items():
157161
if not (isinstance(value, dict) and value.get("type") == "probe"):
158-
conf[key] = config.get(key, value)
162+
config[key] = config.get(key, value)
159163
continue
160164

161165
# we have a dynamic config
162166
name = value.get("name")
163167
provider_type = value["provider"]["type"]
164168
value["provider"]["secrets"] = deepcopy(secrets)
165169
try:
166-
output = run_activity(value, conf, secrets)
170+
output = run_activity(value, config, secrets)
167171
except Exception:
168172
had_errors = True
169173
logger.debug(f"Failed to load configuration '{name}'", exc_info=True)
170174
continue
171175

172176
if provider_type == "python":
173-
conf[key] = output
177+
config[key] = output
174178
elif provider_type == "process":
175179
if output["status"] != 0:
176180
had_errors = True
@@ -179,14 +183,14 @@ def load_dynamic_configuration(
179183
f"from probe '{name}': {output['stderr']}"
180184
)
181185
else:
182-
conf[key] = output.get("stdout", "").strip()
186+
config[key] = output.get("stdout", "").strip()
183187
elif provider_type == "http":
184-
conf[key] = output.get("body")
188+
config[key] = output.get("body")
185189

186190
if had_errors:
187191
logger.warning(
188192
"Some of the dynamic configuration failed to be loaded."
189193
"Please review the log file for understanding what happened."
190194
)
191195

192-
return conf
196+
return config

0 commit comments

Comments
 (0)