From 3c85e1941f95e30b2c592117b4b6b23cecb87bbd Mon Sep 17 00:00:00 2001 From: Steven Hardy <shardy@redhat.com> Date: Thu, 27 Sep 2012 14:43:34 +0100 Subject: [PATCH] heat API : return ResourceProperties as JSON 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 | 2 ++ heat/tests/test_api_cfn_v1.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/heat/api/cfn/v1/stacks.py b/heat/api/cfn/v1/stacks.py index 8218d2c39f..2b8aa65b12 100644 --- a/heat/api/cfn/v1/stacks.py +++ b/heat/api/cfn/v1/stacks.py @@ -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) diff --git a/heat/tests/test_api_cfn_v1.py b/heat/tests/test_api_cfn_v1.py index ac81fe00b5..263e5c7893 100644 --- a/heat/tests/test_api_cfn_v1.py +++ b/heat/tests/test_api_cfn_v1.py @@ -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'}]}}}