From adbccac10a362d7464bb30f9ae923d0446833a21 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 5 Mar 2013 10:13:44 -0500 Subject: 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 --- nova/tests/api/openstack/compute/contrib/test_keypairs.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/contrib/test_keypairs.py b/nova/tests/api/openstack/compute/contrib/test_keypairs.py index 06454b123..025845637 100644 --- a/nova/tests/api/openstack/compute/contrib/test_keypairs.py +++ b/nova/tests/api/openstack/compute/contrib/test_keypairs.py @@ -236,6 +236,11 @@ class KeypairsTest(test.TestCase): res = req.get_response(self.app) self.assertEqual(res.status_int, 202) + def test_keypair_get_keypair_not_found(self): + req = webob.Request.blank('/v2/fake/os-keypairs/DOESNOTEXIST') + res = req.get_response(self.app) + self.assertEqual(res.status_int, 404) + def test_keypair_delete_not_found(self): def db_key_pair_get_not_found(context, user_id, name): -- cgit