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 os
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
import urlparse
|
import urlparse
|
||||||
import webob
|
import webob
|
||||||
from webob.exc import (HTTPNotFound,
|
from webob.exc import (HTTPNotFound,
|
||||||
@ -48,6 +49,13 @@ class StackController(object):
|
|||||||
def __init__(self, options):
|
def __init__(self, options):
|
||||||
self.options = 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):
|
def list(self, req):
|
||||||
"""
|
"""
|
||||||
Returns the following information for all stacks:
|
Returns the following information for all stacks:
|
||||||
@ -65,6 +73,7 @@ class StackController(object):
|
|||||||
summaries = results['StackSummaries']
|
summaries = results['StackSummaries']
|
||||||
if stack_list is not None:
|
if stack_list is not None:
|
||||||
for s in stack_list['stacks']:
|
for s in stack_list['stacks']:
|
||||||
|
s['CreationTime'] = self._to_api_date(s['CreationTime'])
|
||||||
summaries.append(s)
|
summaries.append(s)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
@ -88,8 +97,10 @@ 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']:
|
||||||
mem = {'member': s}
|
s['CreationTime'] = self._to_api_date(s['CreationTime'])
|
||||||
stacks.append(mem)
|
s['LastUpdatedTimestamp'] = self._to_api_date(
|
||||||
|
s['LastUpdatedTimestamp'])
|
||||||
|
stacks.append(s)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user