Add Metadata to detailed Resource output
Change-Id: I492b9a0a190a905ca5c8597c7236ad1d130a5b77 Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
parent
de02376d54
commit
c68b2c5315
|
@ -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,10 +453,8 @@ 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
|
||||
if key in JSON_ONLY_KEYS:
|
||||
if value:
|
||||
subelement.text = str(value)
|
||||
else:
|
||||
self.object_to_element(value, subelement)
|
||||
|
|
|
@ -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…
Reference in New Issue