Browse Source

Add Metadata to detailed Resource output

Change-Id: I492b9a0a190a905ca5c8597c7236ad1d130a5b77
Signed-off-by: Zane Bitter <zbitter@redhat.com>
changes/26/9326/1
Zane Bitter 10 years ago
parent
commit
c68b2c5315
  1. 13
      heat/common/wsgi.py
  2. 2
      heat/engine/manager.py

13
heat/common/wsgi.py

@ -438,6 +438,11 @@ class JSONResponseSerializer(object):
response.body = self.to_json(result)
# Escape XML serialization for these keys, as the AWS API defines them as
# JSON inside XML when the response format is XML.
JSON_ONLY_KEYS = ('TemplateBody', 'Metadata')
class XMLResponseSerializer(object):
def object_to_element(self, obj, element):
@ -448,11 +453,9 @@ class XMLResponseSerializer(object):
elif isinstance(obj, dict):
for key, value in obj.items():
subelement = etree.SubElement(element, key)
if key == "TemplateBody":
# Escape serialization for TemplateBody key, as
# AWS api defines JSON-template-inside-XML format
# ref to GetTemplate AWS CFN API docs
subelement.text = str(value)
if key in JSON_ONLY_KEYS:
if value:
subelement.text = str(value)
else:
self.object_to_element(value, subelement)
else:

2
heat/engine/manager.py

@ -368,6 +368,7 @@ class EngineManager(manager.Manager):
# this API call uses Timestamp instead of LastUpdatedTimestamp
formatted['Timestamp'] = formatted['LastUpdatedTimestamp']
del formatted['LastUpdatedTimestamp']
del formatted['Metadata']
resources.append(formatted)
return resources
@ -525,6 +526,7 @@ def format_stack_resource(resource):
'PhysicalResourceId': resource.instance_id or '',
'ResourceType': resource.t['Type'],
'LastUpdatedTimestamp': heat_utils.strtime(last_updated_time),
'Metadata': rs.rsrc_metadata,
'ResourceStatus': rs.state,
'ResourceStatusReason': rs.state_description,
}

Loading…
Cancel
Save