Merge "Switch to providing created_at field for servers"

This commit is contained in:
Zuul 2018-01-31 20:59:31 +00:00 committed by Gerrit Code Review
commit 2b63418e84
4 changed files with 13 additions and 0 deletions

View File

@ -208,6 +208,7 @@ A Server from Nova
accessIPv6=str(),
addresses=dict(), # string, list(Address)
created=str(),
created_at=str(),
key_name=str(),
metadata=dict(), # string, string
private_v4=str(),

View File

@ -0,0 +1,5 @@
---
features:
- The `created` field which was returned by the Nova API is now returned as
`created_at` as well when not using strict mode for consistency with other
models.

View File

@ -499,6 +499,11 @@ class Normalizer(object):
# Protect against security_groups being None
ret['security_groups'] = server.pop('security_groups', None) or []
# NOTE(mnaser): The Nova API returns the creation date in `created`
# however the Shade contract returns `created_at` for
# all resources.
ret['created_at'] = server.get('created')
for field in _SERVER_FIELDS:
ret[field] = server.pop(field, None)
if not ret['networks']:

View File

@ -566,6 +566,7 @@ class TestUtils(base.TestCase):
u'version': 4}]},
'adminPass': None,
'created': u'2015-08-01T19:52:16Z',
'created_at': u'2015-08-01T19:52:16Z',
'disk_config': u'MANUAL',
'flavor': {u'id': u'bbcb7eb5-5c8d-498f-9d7e-307c575d3566'},
'has_config_drive': True,
@ -635,6 +636,7 @@ class TestUtils(base.TestCase):
'cloud': '_test_cloud_',
'config_drive': u'True',
'created': u'2015-08-01T19:52:16Z',
'created_at': u'2015-08-01T19:52:16Z',
'disk_config': u'MANUAL',
'flavor': {u'id': u'bbcb7eb5-5c8d-498f-9d7e-307c575d3566'},
'has_config_drive': True,