diff options
| author | Russell Bryant <rbryant@redhat.com> | 2013-03-05 10:13:44 -0500 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2013-03-05 10:13:44 -0500 |
| commit | adbccac10a362d7464bb30f9ae923d0446833a21 (patch) | |
| tree | 25ac3e004ce13a399b67fc228de1f1777776a0bb /nova/api | |
| parent | c7684046feaaeceedb05d5267d65157086a9761e (diff) | |
| download | nova-adbccac10a362d7464bb30f9ae923d0446833a21.tar.gz nova-adbccac10a362d7464bb30f9ae923d0446833a21.tar.xz nova-adbccac10a362d7464bb30f9ae923d0446833a21.zip | |
Don't traceback in the API on invalid keypair.
When trying to get a keypair that did not exist, a traceback would end
up in the nova-api log. Handle this exception in the API extension so
that it doesn't make a mess of the log.
Also add a unit test for this particular scenario.
Fix bug 1145545.
Change-Id: Id1647d4ac56629c2931099320d271e34fc2f99b9
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/keypairs.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index 4f6ad6b18..a79b39aae 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -119,7 +119,10 @@ class KeypairController(object): context = req.environ['nova.context'] authorize(context) - keypair = self.api.get_key_pair(context, context.user_id, id) + try: + keypair = self.api.get_key_pair(context, context.user_id, id) + except exception.KeypairNotFound: + raise webob.exc.HTTPNotFound() return {'keypair': keypair} @wsgi.serializers(xml=KeypairsTemplate) |
