diff --git a/translator/hot/tosca/tosca_policies_scaling.py b/translator/hot/tosca/tosca_policies_scaling.py index 1e7e51b0..c1ba9b70 100644 --- a/translator/hot/tosca/tosca_policies_scaling.py +++ b/translator/hot/tosca/tosca_policies_scaling.py @@ -71,16 +71,19 @@ class ToscaAutoscaling(HotResource): template_dict = yaml.load(HEAT_TEMPLATE_BASE) template_dict['description'] = 'Tacker Scaling template' template_dict["resources"] = {} + dict_res = OrderedDict() for res in scale_res: dict_res = res.get_dict_output() res_name = list(dict_res.keys())[0] template_dict["resources"][res_name] = \ dict_res[res_name] + yaml.add_representer(OrderedDict, self.represent_ordereddict) yaml.add_representer(dict, self.represent_ordereddict) + yaml_string = yaml.dump(template_dict, default_flow_style=False) + yaml_string = yaml_string.replace('\'', '') .replace('\n\n', '\n') self.nested_template = { - self.policy.name + '_res.yaml': - yaml.dump(template_dict, default_flow_style=False) + self.policy.name + '_res.yaml': yaml_string } def handle_properties(self, resources): diff --git a/translator/tests/data/hot_output/nfv/SP1_res.yaml b/translator/tests/data/hot_output/nfv/SP1_res.yaml index d42bb782..70ae6dc6 100644 --- a/translator/tests/data/hot_output/nfv/SP1_res.yaml +++ b/translator/tests/data/hot_output/nfv/SP1_res.yaml @@ -9,7 +9,7 @@ resources: image: cirros-0.3.4-x86_64-uec flavor: m1.tiny networks: - - port: '{ get_resource: CP1 }' + - port: { get_resource: CP1 } config_drive: false CP1: type: OS::Neutron::Port @@ -31,7 +31,7 @@ resources: image: cirros-0.3.4-x86_64-uec flavor: m1.tiny networks: - - port: '{ get_resource: CP2 }' + - port: { get_resource: CP2 } config_drive: false VL1: type: OS::Neutron::Net