heat API : Align time format with AWS spec
- Reformat ListStacks/DescribeStacks responses to align time format with AWS spec - Remove duplicate member tags in DescribeStacks (now handled by XMLResponseSerializer) ref #125 Change-Id: Ib001acba591dba52f3f56052427d2b298d781ea0 Signed-off-by: Steven Hardy <shardy@redhat.com>
This commit is contained in:
parent
88c8bdee3f
commit
f7f4755076
|
@ -22,6 +22,7 @@ import logging
|
|||
import os
|
||||
import socket
|
||||
import sys
|
||||
import re
|
||||
import urlparse
|
||||
import webob
|
||||
from webob.exc import (HTTPNotFound,
|
||||
|
@ -48,6 +49,13 @@ class StackController(object):
|
|||
def __init__(self, options):
|
||||
self.options = options
|
||||
|
||||
# convert date so it is aligned with aws date spec
|
||||
# engine returns UTC date "2012-06-15 18:24:32"
|
||||
# AWS format is "2012-06-15T18:24:32Z"
|
||||
def _to_api_date(self, db_date):
|
||||
return re.sub("([0-9]+-[0-9]+-[0-9]+) ([0-9]+:[0-9]+:[0-9]+)$",
|
||||
"\\1T\\2Z", str(db_date))
|
||||
|
||||
def list(self, req):
|
||||
"""
|
||||
Returns the following information for all stacks:
|
||||
|
@ -65,6 +73,7 @@ class StackController(object):
|
|||
summaries = results['StackSummaries']
|
||||
if stack_list is not None:
|
||||
for s in stack_list['stacks']:
|
||||
s['CreationTime'] = self._to_api_date(s['CreationTime'])
|
||||
summaries.append(s)
|
||||
|
||||
return res
|
||||
|
@ -88,8 +97,10 @@ class StackController(object):
|
|||
res = {'DescribeStacksResult': {'Stacks': []}}
|
||||
stacks = res['DescribeStacksResult']['Stacks']
|
||||
for s in stack_list['stacks']:
|
||||
mem = {'member': s}
|
||||
stacks.append(mem)
|
||||
s['CreationTime'] = self._to_api_date(s['CreationTime'])
|
||||
s['LastUpdatedTimestamp'] = self._to_api_date(
|
||||
s['LastUpdatedTimestamp'])
|
||||
stacks.append(s)
|
||||
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue