heat API : Align DescribeStacks response with AWS docs

Reformat the DescribeStacks response to more closely align
with the AWS API spec - boto parses the result correctly with
these changes.  Ref #125

Change-Id: I23b270c040653f404014807de79c85b2ab63c85f
Signed-off-by: Steven Hardy <shardy@redhat.com>
This commit is contained in:
Steven Hardy 2012-06-25 14:15:51 +01:00
parent d2487050b6
commit 34f1bb34a5
2 changed files with 7 additions and 1 deletions

View File

@ -98,6 +98,12 @@ class StackController(object):
res = {'DescribeStacksResult': {'Stacks': []}} res = {'DescribeStacksResult': {'Stacks': []}}
stacks = res['DescribeStacksResult']['Stacks'] stacks = res['DescribeStacksResult']['Stacks']
for s in stack_list['stacks']: for s in stack_list['stacks']:
# Reformat Parameters dict-of-dict into AWS API format
# This is a list-of-dict with nasty "ParameterKey" : key
# "ParameterValue" : value format.
s['Parameters'] = [{'ParameterKey':k,
'ParameterValue':v.get('Default')}
for (k, v) in s['Parameters'].items()]
stacks.append(self._stackid_addprefix(s)) stacks.append(self._stackid_addprefix(s))
return res return res

View File

@ -130,7 +130,7 @@ class EngineManager(manager.Manager):
mem['NotificationARNs'] = 'TODO' mem['NotificationARNs'] = 'TODO'
mem['Parameters'] = ps.t['Parameters'] mem['Parameters'] = ps.t['Parameters']
mem['TimeoutInMinutes'] = ps.t.get('Timeout', '60') mem['TimeoutInMinutes'] = ps.t.get('Timeout', '60')
mem['TemplateDescription'] = ps.t.get('Description', mem['Description'] = ps.t.get('Description',
'No description') 'No description')
mem['StackStatus'] = s.status mem['StackStatus'] = s.status
mem['StackStatusReason'] = s.status_reason mem['StackStatusReason'] = s.status_reason