summaryrefslogtreecommitdiffstats
path: root/nova/api/openstack/compute/plugins/v3
diff options
context:
space:
mode:
authorRick Harris <rconradharris@gmail.com>2013-06-05 22:44:35 +0000
committerRick Harris <rconradharris@gmail.com>2013-06-06 23:14:49 +0000
commitfd55a4e1d049748634e6d802ca124cb67596cd52 (patch)
tree3861ca3aa5e2b619d0b1b1ef3b59c8e9ab849819 /nova/api/openstack/compute/plugins/v3
parent364a00019daea8e2c8006de6e0fafc2193808659 (diff)
downloadnova-fd55a4e1d049748634e6d802ca124cb67596cd52.tar.gz
nova-fd55a4e1d049748634e6d802ca124cb67596cd52.tar.xz
nova-fd55a4e1d049748634e6d802ca124cb67596cd52.zip
Improve Keypair error messages in osapi
The KeypairAPI code provides useful error messages that weren't being percolated back through the OpenStack API. This patch addresses this by using the original `message` when crafting the HTTPException objects. References bug 1187952 Change-Id: I786a225010d912d7bfea5c01838ddcf43fd90d53
Diffstat (limited to 'nova/api/openstack/compute/plugins/v3')
-rw-r--r--nova/api/openstack/compute/plugins/v3/keypairs.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/nova/api/openstack/compute/plugins/v3/keypairs.py b/nova/api/openstack/compute/plugins/v3/keypairs.py
index 4051a3497..bf740641e 100644
--- a/nova/api/openstack/compute/plugins/v3/keypairs.py
+++ b/nova/api/openstack/compute/plugins/v3/keypairs.py
@@ -95,12 +95,10 @@ class KeypairController(object):
raise webob.exc.HTTPRequestEntityTooLarge(
explanation=msg,
headers={'Retry-After': 0})
- except exception.InvalidKeypair:
- msg = _("Keypair data is invalid")
- raise webob.exc.HTTPBadRequest(explanation=msg)
- except exception.KeyPairExists:
- msg = _("Key pair '%s' already exists.") % name
- raise webob.exc.HTTPConflict(explanation=msg)
+ except exception.InvalidKeypair as exc:
+ raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
+ except exception.KeyPairExists as exc:
+ raise webob.exc.HTTPConflict(explanation=exc.format_message())
def delete(self, req, id):
"""