From 9254403281fad200f871c5e6ff052dc79c739d6e Mon Sep 17 00:00:00 2001 From: Zhi Yan Liu Date: Fri, 5 Apr 2013 22:06:18 +0800 Subject: Correct network uuid field for os-network extension "nova net-list" does not return network uuid even when the uuid is available, and instead returns only the id. This is because the "network_dict" function in the extension improperly uses "in" to check for a Network model object. This also reduces compatibility in the API. Fixes bug: 1162409 Change-Id: I30d4c8bfa37d89123f35ee8cc7c67f0e819262a7 Signed-off-by: Zhi Yan Liu --- nova/api/openstack/compute/contrib/os_networks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/os_networks.py b/nova/api/openstack/compute/contrib/os_networks.py index 2cea0e081..e8a5263aa 100644 --- a/nova/api/openstack/compute/contrib/os_networks.py +++ b/nova/api/openstack/compute/contrib/os_networks.py @@ -47,8 +47,9 @@ def network_dict(context, network): if context.is_admin: fields += admin_fields result = dict((field, network.get(field)) for field in fields) - if 'uuid' in network: - result['id'] = network['uuid'] + uuid = network.get('uuid') + if uuid: + result['id'] = uuid return result else: return {} -- cgit