From 980ac0e981de248f9d687b2dd91ea93f5ebdae6a Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Thu, 23 Jun 2011 16:10:26 -0400 Subject: Fixed issue with zero flavors returning HTTP 500 --- nova/api/openstack/flavors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index a21ff6cb2..be295b372 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -42,7 +42,10 @@ class Controller(object): def _get_flavors(self, req, is_detail=True): """Helper function that returns a list of flavor dicts.""" ctxt = req.environ['nova.context'] - flavors = db.api.instance_type_get_all(ctxt) + try: + flavors = db.api.instance_type_get_all(ctxt) + except exception.NoInstanceTypesFound: + flavors = {} builder = self._get_view_builder(req) items = [builder.build(flavor, is_detail=is_detail) for flavor in flavors.values()] -- cgit