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
This commit is contained in:
LiangLu 2021-03-02 19:09:42 +09:00
parent 7e8a7351fa
commit a8516bb079
1 changed files with 5 additions and 5 deletions

View File

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