From cd7dd2430df1dcb284a4810205fdf3c8b04d5460 Mon Sep 17 00:00:00 2001 From: Aliaksei Tatarynchyk Date: Mon, 3 Jun 2019 12:01:09 +0300 Subject: [PATCH] Revert "Combine play and write into one step (#39)" because it causes the issue with shaper play (#44) (#45) This reverts commit 6e37ec43c05ff190a63897d4ff43dfa296df40e2. --- shaper/renderer.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/shaper/renderer.py b/shaper/renderer.py index 42f29f1..d0df939 100644 --- a/shaper/renderer.py +++ b/shaper/renderer.py @@ -4,7 +4,6 @@ from __future__ import print_function import os -from collections import OrderedDict import yaml from jinja2 import Environment, FileSystemLoader, Undefined @@ -57,15 +56,14 @@ def merge_templates(rendered_templates, out_dir): :param rendered_templates: list of rendered templates to merge - :param out_dir: path to rendered property files + :param out_dir: path to rendered templates :return: None """ - datastructure = {} + dict_base = {} for var in rendered_templates: - datastructure.update(yaml.safe_load(var)) + dict_base.update(yaml.safe_load(var)) - datastructure = manager.backward_path_parser(datastructure) - for key in datastructure: - datastructure[key] = OrderedDict((k, v) for k, v in sorted(datastructure[key].items())) - manager.write_properties(datastructure, out_dir) + manager.create_folders(out_dir) + with open(os.path.join(out_dir, 'templates.yaml'), 'w') as _fd: + yaml.dump(dict_base, _fd, default_flow_style=False)