Add catch FlavorExtraSpecsNotFound in V2 API.

we catch FlavorExtraSpecsNotFound in v3 API but we didn't catch it
at v2 API. This patch adds it and no need to add unit test
because v2 v3 share unit test.

Change-Id: I926b7cc443ccd9d0fea6a55bef4c3485ae7abe7d
This commit is contained in:
jichenjc 2014-11-19 17:41:15 +08:00
parent f0ad0759e4
commit f86377262c
1 changed files with 2 additions and 1 deletions

View File

@ -133,7 +133,8 @@ class FlavorExtraSpecsController(object):
flavor = objects.Flavor.get_by_flavor_id(context, flavor_id)
del flavor.extra_specs[id]
flavor.save()
except exception.FlavorNotFound as e:
except (exception.FlavorNotFound,
exception.FlavorExtraSpecsNotFound) as e:
raise exc.HTTPNotFound(explanation=e.format_message())
except KeyError:
msg = _("Flavor %(flavor_id)s has no extra specs with "