]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Recursively replace all : with . in Output keys.
authorSteve Baker <sbaker@redhat.com>
Fri, 2 Nov 2012 04:07:47 +0000 (17:07 +1300)
committerSteve Baker <sbaker@redhat.com>
Mon, 5 Nov 2012 03:10:00 +0000 (16:10 +1300)
This is needed so that some Quantum properties with colons in the keys are not
interpreted as xml namespaces.

Change-Id: Iba5290a408595b2f028744c10315daac29da055e

heat/api/cfn/v1/stacks.py

index 6cc48961d82326eb90bd4248a235f348ece23191..7c18f541815536299d098352b0e12db1980dbb22 100644 (file)
@@ -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):
             """