Skip to content

Commit

Permalink
[resotocore][fix] yaml handling (#1880)
Browse files Browse the repository at this point in the history
* [resotocore][fix] yaml handling

* pesky newlines
  • Loading branch information
aquamatthias authored Jan 15, 2024
1 parent 5a49a4d commit 4501014
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions resotocore/resotocore/config/config_handler_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,15 @@ def mkstr(val: Any) -> str:
overrides_json = overrides if isinstance(overrides, dict) else {}

for num, (key, value) in enumerate(config.config.items()):
if num > 0:
yaml_str += "\n"
maybe_kind = model.get(key)
if isinstance(maybe_kind, ComplexKind):
part = maybe_kind.create_yaml(value, initial_level=1, overrides=overrides_json.get(key) or {})
if num > 0:
yaml_str += "\n"
yaml_str += key + ":" + part
else:
yaml_str += yaml.dump({key: value}, sort_keys=False, allow_unicode=True)
yaml_str += yaml.dump({key: value}, sort_keys=False, allow_unicode=True).removesuffix("\n")
yaml_str += "\n"

# mix the revision into the yaml document
if revision and config.revision:
Expand Down

0 comments on commit 4501014

Please sign in to comment.