diff options
| author | Ahmad Hassan <ahmad.hassan@hp.com> | 2011-10-05 17:02:45 +0100 |
|---|---|---|
| committer | Stanislaw Pitucha <stanislaw.pitucha@hp.com> | 2011-10-06 14:21:13 +0100 |
| commit | 2915e6ba054b1f4100f788603358ea5b2b8220d5 (patch) | |
| tree | 3492e4c3057172e8710978e9f678613a47774b4f /nova/api | |
| parent | 72c45bd2ad930922be86c810b393187e4f5564bc (diff) | |
Make sure unknown extensions return 404
At the moment, if an extension doens't exist and we call a show method
with wrong id then the exception is not captured. There is a need to
return NOTFOUND exception.
Fixes bug 869153.
Change-Id: Ie0b2c2e87c5a61f6db74bb10a4740add2ab8ea27
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/extensions.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py index fae2bb1b1..43bc06014 100644 --- a/nova/api/openstack/extensions.py +++ b/nova/api/openstack/extensions.py @@ -197,8 +197,12 @@ class ExtensionsResource(wsgi.Resource): return dict(extensions=extensions) def show(self, req, id): - # NOTE(dprince): the extensions alias is used as the 'id' for show - ext = self.extension_manager.extensions[id] + try: + # NOTE(dprince): the extensions alias is used as the 'id' for show + ext = self.extension_manager.extensions[id] + except KeyError: + return faults.Fault(webob.exc.HTTPNotFound()) + return dict(extension=self._translate(ext)) def delete(self, req, id): |
