Force list when returning map(replaced_list_value, template_part)

As suggested by Jiri in this review adding a list() around
'map(replaced_list_value, template_part)' fixes the py3 issue
for me.

Closes-bug: #1819737
Change-Id: I1241985eac1aa7e092a11db5a443da0055ff0141
This commit is contained in:
Bogdan Dobrelya 2019-03-13 15:37:07 +01:00 committed by Michele Baldessari
parent 969e01ad88
commit f388fceeef
2 changed files with 13 additions and 1 deletions

View File

@ -811,6 +811,12 @@ class TestReplaceLinks(TestCase):
source = (
'description: my template\n'
'heat_template_version: "2014-10-16"\n'
'parameters:\n'
' foo:\n'
' default: ["bar"]\n'
' type: json\n'
' bar:\n'
' default: []\n'
'resources:\n'
' test_config:\n'
' properties:\n'
@ -820,6 +826,12 @@ class TestReplaceLinks(TestCase):
expected = (
'description: my template\n'
'heat_template_version: "2014-10-16"\n'
'parameters:\n'
' foo:\n'
' default: ["bar"]\n'
' type: json\n'
' bar:\n'
' default: []\n'
'resources:\n'
' test_config:\n'
' properties:\n'

View File

@ -901,7 +901,7 @@ def replace_links_in_template(template_part, link_replacement):
return {k: replaced_dict_value(k, v)
for k, v in six.iteritems(template_part)}
elif isinstance(template_part, list):
return map(replaced_list_value, template_part)
return list(map(replaced_list_value, template_part))
else:
return template_part