Remove invalid char ' from translated nested autoscaling template

The translation of autoscaling template requires to produce nested templates,
which currently injecting invalid char in some properties.

Change-Id: I60a770694c39cc364d3b7a8507ee791ebbdf3507
Related-Bug: 1652928
This commit is contained in:
sahdev zala 2017-01-09 16:07:17 -05:00
parent c1f97795e2
commit 4048520645
2 changed files with 7 additions and 4 deletions

View File

@ -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):

View File

@ -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