corrects incorrect openstack api responses for metadata (numeric/string conversion issue) and image format status (not uppercase)
This commit is contained in:
commit
94e35cb15f
|
@ -34,11 +34,11 @@ class ViewBuilder(object):
|
|||
def _format_status(self, image):
|
||||
"""Update the status field to standardize format."""
|
||||
status_mapping = {
|
||||
'pending': 'queued',
|
||||
'decrypting': 'preparing',
|
||||
'untarring': 'saving',
|
||||
'available': 'active',
|
||||
'killed': 'failed',
|
||||
'pending': 'QUEUED',
|
||||
'decrypting': 'PREPARING',
|
||||
'untarring': 'SAVING',
|
||||
'available': 'ACTIVE',
|
||||
'killed': 'FAILED',
|
||||
}
|
||||
|
||||
try:
|
||||
|
|
|
@ -82,7 +82,7 @@ class ViewBuilder(object):
|
|||
# Return the metadata as a dictionary
|
||||
metadata = {}
|
||||
for item in inst.get('metadata', []):
|
||||
metadata[item['key']] = item['value']
|
||||
metadata[item['key']] = str(item['value'])
|
||||
inst_dict['metadata'] = metadata
|
||||
|
||||
inst_dict['hostId'] = ''
|
||||
|
|
|
@ -751,7 +751,7 @@ class ServersTest(test.TestCase):
|
|||
self.assertEqual(s['imageId'], '10')
|
||||
self.assertEqual(s['flavorId'], 1)
|
||||
self.assertEqual(s['status'], 'BUILD')
|
||||
self.assertEqual(s['metadata']['seq'], i)
|
||||
self.assertEqual(s['metadata']['seq'], str(i))
|
||||
|
||||
def test_get_all_server_details_v1_1(self):
|
||||
req = webob.Request.blank('/v1.1/servers/detail')
|
||||
|
@ -765,7 +765,7 @@ class ServersTest(test.TestCase):
|
|||
self.assertEqual(s['imageRef'], 'http://localhost/v1.1/images/10')
|
||||
self.assertEqual(s['flavorRef'], 'http://localhost/v1.1/flavors/1')
|
||||
self.assertEqual(s['status'], 'BUILD')
|
||||
self.assertEqual(s['metadata']['seq'], i)
|
||||
self.assertEqual(s['metadata']['seq'], str(i))
|
||||
|
||||
def test_get_all_server_details_with_host(self):
|
||||
'''
|
||||
|
|
Loading…
Reference in New Issue