summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-08-17 13:54:38 +0000
committerTarmac <>2011-08-17 13:54:38 +0000
commitaca07a42fabb7f506cf132b995b4ad0139987b02 (patch)
tree53d13015fa637549a9b0ce7613b13af9fbe57198 /nova/api
parent6dbcc60d5f8d4995a706f0de449756ecea4ebaa0 (diff)
parent71935201aed268e94ee9674e887d67b4b9f217a6 (diff)
DB object was being casted to dict() in API code. This did not work as intended and logic has been updated to reflect a more accurate way of getting information out of DB objects.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/views/servers.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index 8222f6766..edc328129 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -111,14 +111,14 @@ class ViewBuilderV10(ViewBuilder):
response['uuid'] = inst['uuid']
def _build_image(self, response, inst):
- if 'image_ref' in dict(inst):
+ if inst.get('image_ref', None):
image_ref = inst['image_ref']
if str(image_ref).startswith('http'):
raise exception.ListingImageRefsNotSupported()
response['imageId'] = int(image_ref)
def _build_flavor(self, response, inst):
- if 'instance_type' in dict(inst):
+ if inst.get('instance_type', None):
response['flavorId'] = inst['instance_type']['flavorid']
def _build_addresses(self, response, inst):
@@ -146,7 +146,7 @@ class ViewBuilderV11(ViewBuilder):
return response
def _build_image(self, response, inst):
- if 'image_ref' in dict(inst):
+ if inst.get("image_ref", None):
image_href = inst['image_ref']
image_id = str(common.get_id_from_href(image_href))
_bookmark = self.image_builder.generate_bookmark(image_id)
@@ -161,7 +161,7 @@ class ViewBuilderV11(ViewBuilder):
}
def _build_flavor(self, response, inst):
- if "instance_type" in dict(inst):
+ if inst.get("instance_type", None):
flavor_id = inst["instance_type"]['flavorid']
flavor_ref = self.flavor_builder.generate_href(flavor_id)
flavor_bookmark = self.flavor_builder.generate_bookmark(flavor_id)