From 271acd8a0434a1e23d29df26cb1a211d1c28d8cf Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Sat, 28 Jan 2012 19:26:29 -0800 Subject: Handle kepair delete when not found Fixes bug 900924 Change-Id: Icd0a1f69c0fb7c15110bbf0c416e38cdc1147f4d --- nova/api/openstack/compute/contrib/keypairs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py index 512f8660a..57ac48dbc 100644 --- a/nova/api/openstack/compute/contrib/keypairs.py +++ b/nova/api/openstack/compute/contrib/keypairs.py @@ -17,11 +17,8 @@ """ Keypair management extension""" -import os -import shutil -import tempfile - import webob +import webob.exc from nova.api.openstack import wsgi from nova.api.openstack import xmlutil @@ -122,7 +119,10 @@ class KeypairController(object): """ context = req.environ['nova.context'] authorize(context) - db.key_pair_destroy(context, context.user_id, id) + try: + db.key_pair_destroy(context, context.user_id, id) + except exception.KeypairNotFound: + raise webob.exc.HTTPNotFound() return webob.Response(status_int=202) @wsgi.serializers(xml=KeypairsTemplate) -- cgit