From: Steve Baker Date: Fri, 2 Nov 2012 04:07:47 +0000 (+1300) Subject: Recursively replace all : with . in Output keys. X-Git-Tag: 2014.1~1249 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b3a57062ade24b9fbfc1f02f130ad353fffc49d4;p=openstack-build%2Fheat-build.git Recursively replace all : with . in Output keys. This is needed so that some Quantum properties with colons in the keys are not interpreted as xml namespaces. Change-Id: Iba5290a408595b2f028744c10315daac29da055e --- diff --git a/heat/api/cfn/v1/stacks.py b/heat/api/cfn/v1/stacks.py index 6cc48961..7c18f541 100644 --- a/heat/api/cfn/v1/stacks.py +++ b/heat/api/cfn/v1/stacks.py @@ -148,7 +148,22 @@ class StackController(object): engine_api.OUTPUT_VALUE: 'OutputValue', } - return api_utils.reformat_dict_keys(keymap, o) + def replacecolon(d): + return dict(map(lambda (k, v): + (k.replace(':', '.'), v), d.items())) + + def transform(attrs): + """ + Recursively replace all : with . in dict keys + so that they are not interpreted as xml namespaces. + """ + new = replacecolon(attrs) + for key, value in new.items(): + if isinstance(value, dict): + new[key] = transform(value) + return new + + return api_utils.reformat_dict_keys(keymap, transform(o)) def format_stack(s): """