]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat API : return ResourceProperties as JSON
authorSteven Hardy <shardy@redhat.com>
Thu, 27 Sep 2012 13:43:34 +0000 (14:43 +0100)
committerSteven Hardy <shardy@redhat.com>
Thu, 27 Sep 2012 13:46:56 +0000 (14:46 +0100)
For boto to correctly parse the API DescribeStackEvents
action, the ResourceProperties key in the response
must be a string, as per the AWS spec, so we encode the
properties in a JSON blob

Fixes #245

Change-Id: Icd38984836a941ed4a012b06382933bb46f43c4f
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/api/cfn/v1/stacks.py
heat/tests/test_api_cfn_v1.py

index 8218d2c39f164e2d0ba223aca83c5f029dea6b5a..2b8aa65b12f350dc765338b8abfb6ee61abf9f02 100644 (file)
@@ -426,6 +426,8 @@ class StackController(object):
             }
 
             result = api_utils.reformat_dict_keys(keymap, e)
+            result['ResourceProperties'] = json.dumps(
+                                           result['ResourceProperties'])
 
             return self._stackid_format(result)
 
index ac81fe00b5da63a8461df3b5f5489c8dfe352dea..263e5c7893b2794b730edb6c3ab1031fd66f75d1 100644 (file)
@@ -808,7 +808,7 @@ class StackControllerTest(unittest.TestCase):
                 'ResourceType': u'AWS::EC2::Instance',
                 'Timestamp': u'2012-07-23T13:05:39Z',
                 'StackName': u'wordpress',
-                'ResourceProperties': {u'UserData': u'blah'},
+                'ResourceProperties': json.dumps({u'UserData': u'blah'}),
                 'PhysicalResourceId': None,
                 'ResourceStatusReason': u'state changed',
                 'LogicalResourceId': u'WikiDatabase'}]}}}