diff --git a/heat/engine/api.py b/heat/engine/api.py index f80b05ef49..049043f603 100644 --- a/heat/engine/api.py +++ b/heat/engine/api.py @@ -367,7 +367,7 @@ def format_stack_resource(resource, detail=True, with_props=False, def format_stack_preview(stack): def format_resource(res): if isinstance(res, list): - return map(format_resource, res) + return list(map(format_resource, res)) return format_stack_resource(res, with_props=True) fmt_stack = format_stack(stack, preview=True) diff --git a/heat_integrationtests/functional/test_preview.py b/heat_integrationtests/functional/test_preview.py index 99c24ebd3b..4b9d77c6b5 100644 --- a/heat_integrationtests/functional/test_preview.py +++ b/heat_integrationtests/functional/test_preview.py @@ -222,8 +222,16 @@ resources: stack_name=stack_name, template=main_template, files={'nested.yaml': nested_template}).to_dict() + + resource_names = [] + + def get_resource_names(resources): + for item in resources: + if isinstance(item, dict): + resource_names.append(item['resource_name']) + else: + get_resource_names(item) + get_resource_names(result['resources']) # ensure that fixed network and port here - self.assertEqual('fixed_network', - result['resources'][0]['resource_name']) - self.assertEqual('port', - result['resources'][1][0][0]['resource_name']) + self.assertIn('fixed_network', resource_names) + self.assertIn('port', resource_names)