Skip to content

Commit 3569723

Browse files
committed
Fix #250
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent d39ff30 commit 3569723

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
[Unreleased]: https://github.com/chaostoolkit/chaostoolkit-lib/compare/1.27.0...HEAD
66

7+
### Changed
8+
9+
- Ensure dynamic configuration can reference itself [#250][250]
10+
11+
[250]: https://github.com/chaostoolkit/chaostoolkit-lib/issues/250
12+
713
## [1.27.0][] - 2022-02-17
814

915
[1.27.0]: https://github.com/chaostoolkit/chaostoolkit-lib/compare/1.26.0...1.27.0

chaoslib/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def load_dynamic_configuration(
163163
provider_type = value["provider"]["type"]
164164
value["provider"]["secrets"] = deepcopy(secrets)
165165
try:
166-
output = run_activity(value, config, secrets)
166+
output = run_activity(value, conf, secrets)
167167
except Exception:
168168
had_errors = True
169169
logger.debug(f"Failed to load configuration '{name}'", exc_info=True)

tests/test_configuration.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,31 @@ def test_dynamic_configuration_exception_means_output_is_missing():
322322

323323
assert config["somekey"] == "hello world"
324324
assert "token" not in config
325+
326+
327+
def test_dynamic_configuration_can_be_used_next_key():
328+
config = load_dynamic_configuration(
329+
{
330+
"capped": {
331+
"type": "probe",
332+
"provider": {
333+
"type": "python",
334+
"module": "string",
335+
"func": "capwords",
336+
"arguments": {"s": "hello world from earth"},
337+
},
338+
},
339+
"shorten": {
340+
"type": "probe",
341+
"provider": {
342+
"type": "python",
343+
"module": "textwrap",
344+
"func": "shorten",
345+
"arguments": {"text": "${capped}", "width": 12},
346+
},
347+
},
348+
}
349+
)
350+
351+
assert config["capped"] == "Hello World From Earth"
352+
assert config["shorten"] == "Hello [...]"

0 commit comments

Comments
 (0)