diff --git a/heat/api/v1/stacks.py b/heat/api/v1/stacks.py index 3e6a754451..5831163615 100644 --- a/heat/api/v1/stacks.py +++ b/heat/api/v1/stacks.py @@ -49,13 +49,6 @@ 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: @@ -73,7 +66,6 @@ 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 @@ -97,9 +89,6 @@ class StackController(object): res = {'DescribeStacksResult': {'Stacks': []}} stacks = res['DescribeStacksResult']['Stacks'] for s in stack_list['stacks']: - s['CreationTime'] = self._to_api_date(s['CreationTime']) - s['LastUpdatedTimestamp'] = self._to_api_date( - s['LastUpdatedTimestamp']) stacks.append(s) return res diff --git a/heat/common/utils.py b/heat/common/utils.py index f39104c721..666d3ae413 100644 --- a/heat/common/utils.py +++ b/heat/common/utils.py @@ -32,7 +32,7 @@ from eventlet.green import subprocess from heat.openstack.common import exception from heat.openstack.common import timeutils -PERFECT_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f" +PERFECT_TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" def chunkreadable(iter, chunk_size=65536): diff --git a/heat/engine/manager.py b/heat/engine/manager.py index 46a3c293c7..5de0ffe78d 100644 --- a/heat/engine/manager.py +++ b/heat/engine/manager.py @@ -27,6 +27,7 @@ import eventlet from heat import manager from heat.db import api as db_api from heat.common import config +from heat.common import utils as heat_utils from heat.engine import parser from heat.engine import resources from heat.engine import watchrule @@ -150,7 +151,7 @@ class EngineManager(manager.Manager): mem = {} mem['StackId'] = s.id mem['StackName'] = s.name - mem['CreationTime'] = str(s.created_at) + mem['CreationTime'] = heat_utils.strtime(s.created_at) mem['TemplateDescription'] = ps.t.get('Description', 'No description') mem['StackStatus'] = ps.t.get('stack_status', 'unknown') @@ -176,8 +177,8 @@ class EngineManager(manager.Manager): mem = {} mem['StackId'] = s.id mem['StackName'] = s.name - mem['CreationTime'] = str(s.created_at) - mem['LastUpdatedTimestamp'] = str(s.updated_at) + mem['CreationTime'] = heat_utils.strtime(s.created_at) + mem['LastUpdatedTimestamp'] = heat_utils.strtime(s.updated_at) mem['NotificationARNs'] = 'TODO' mem['Parameters'] = ps.t['Parameters'] mem['TimeoutInMinutes'] = ps.t.get('Timeout', '60') @@ -255,7 +256,7 @@ class EngineManager(manager.Manager): greenpool.spawn_n(stack.create) return {'stack': {'id': new_s.id, 'name': new_s.name, - 'CreationTime': str(new_s.created_at)}} + 'CreationTime': heat_utils.strtime(new_s.created_at)}} def validate_template(self, context, template, params): """