From a8516bb07962f1bf79b8a9a440a3b755e4f893dd Mon Sep 17 00:00:00 2001 From: LiangLu Date: Tue, 2 Mar 2021 19:09:42 +0900 Subject: [PATCH] Fix bug only last vdu will be saved to nested_tpl When instantiating multiple VDU using `OS::Heat::AutoScalingGroup` type in vnfd with SOL format, an error about not being able to find the specified type occurred. In current `for loop` of update_nested_scaling_resources(), only the last data will be stored into the nested_tpl[], the other data will be lost. This modification changed the logic of the `for loop`, it will store all types of data configuration into nested_tpl[] according to the `aspect id`. Closes-Bug: 1917314 Change-Id: I40eb711b7d0e8e2cf61f0210151be60febd08407 --- tacker/tosca/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tacker/tosca/utils.py b/tacker/tosca/utils.py index 3da2722ca..18806cf13 100644 --- a/tacker/tosca/utils.py +++ b/tacker/tosca/utils.py @@ -1266,6 +1266,9 @@ def update_nested_scaling_resources(nested_resources, mgmt_ports, metadata, res_tpl, unsupported_res_prop=None, grant_info=None, inst_req_info=None): nested_tpl = dict() + yaml.SafeDumper.add_representer( + OrderedDict, lambda dumper, value: represent_odict( + dumper, 'tag:yaml.org,2002:map', value)) for nested_resource_name, nested_resources_yaml in \ nested_resources.items(): nested_resources_dict =\ @@ -1304,11 +1307,8 @@ def update_nested_scaling_resources(nested_resources, mgmt_ports, metadata, nested_resources_dict['outputs'] = output LOG.debug(_('Added output for %s'), outputname) - yaml.SafeDumper.add_representer( - OrderedDict, lambda dumper, value: represent_odict( - dumper, 'tag:yaml.org,2002:map', value)) - nested_tpl[nested_resource_name] =\ - yaml.safe_dump(nested_resources_dict) + nested_tpl[nested_resource_name] =\ + yaml.safe_dump(nested_resources_dict) return nested_tpl