From 45010142e623534e09533d4143aec0cc1b5f57ba Mon Sep 17 00:00:00 2001 From: Matthias Veit Date: Mon, 15 Jan 2024 16:17:29 +0100 Subject: [PATCH] [resotocore][fix] yaml handling (#1880) * [resotocore][fix] yaml handling * pesky newlines --- resotocore/resotocore/config/config_handler_service.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resotocore/resotocore/config/config_handler_service.py b/resotocore/resotocore/config/config_handler_service.py index 995118f29c..57692909a4 100644 --- a/resotocore/resotocore/config/config_handler_service.py +++ b/resotocore/resotocore/config/config_handler_service.py @@ -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: