Don't set list_type to dict for server groups.

When server_groups is present for retrieved server, this ends up
with the following exception [1]. So we should rather have
regular list instead of dict.

[1] http://paste.openstack.org/show/797758/

Change-Id: I40c4c5241d02aa9d6e61a8064b48a91bde5e6e77
Story: 2007710
Task: 39843
This commit is contained in:
John Petrini 2020-09-01 15:21:59 -04:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 1195f95016
commit 1c2a06350d
2 changed files with 3 additions and 1 deletions

View File

@ -170,7 +170,7 @@ class Server(resource.Resource, metadata.MetadataMixin, resource.TagMixin):
type=list, list_type=dict)
#: The UUIDs of the server groups to which the server belongs.
#: Currently this can contain at most one entry.
server_groups = resource.Body('server_groups', type=list, list_type=dict)
server_groups = resource.Body('server_groups', type=list)
#: The state this server is in. Valid values include ``ACTIVE``,
#: ``BUILDING``, ``DELETED``, ``ERROR``, ``HARD_REBOOT``, ``PASSWORD``,
#: ``PAUSED``, ``REBOOT``, ``REBUILD``, ``RESCUED``, ``RESIZED``,

View File

@ -104,6 +104,7 @@ EXAMPLE = {
'name': 'default'
}
],
'server_groups': ['3caf4187-8010-491f-b6f5-a4a68a40371e'],
'status': 'ACTIVE',
'tags': [],
'tenant_id': '6f70656e737461636b20342065766572',
@ -206,6 +207,7 @@ class TestServer(base.TestCase):
self.assertEqual(EXAMPLE['name'], sot.name)
self.assertEqual(EXAMPLE['progress'], sot.progress)
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
self.assertEqual(EXAMPLE['server_groups'], sot.server_groups)
self.assertEqual(EXAMPLE['status'], sot.status)
self.assertEqual(EXAMPLE['updated'], sot.updated_at)
self.assertEqual(EXAMPLE['user_id'], sot.user_id)