Switch to providing created_at field for servers
All of the current models return the creation date in created_at with the exception of servers which are currently returned with a created field instead. This patch addresses this and gives the ability to get access to both. Change-Id: Ifbd59834080eea62dead19d18a9a11a851a4ce2e
This commit is contained in:
parent
4ab1dac7a5
commit
41a7c9f55a
@ -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(),
|
||||
|
@ -503,6 +503,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']:
|
||||
|
@ -575,6 +575,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,
|
||||
@ -644,6 +645,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,
|
||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user