summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-06-10 17:59:11 +0000
committerGerrit Code Review <review@openstack.org>2013-06-10 17:59:11 +0000
commit0cec0a78a5bfca24b5cadda8fb5cdc9d9db91c3d (patch)
tree28bcaee7efc93e2a4d34bcd9e30c577e02adc210 /nova/api
parente6393e560b1910743bce6dbe23c9bb4c3a244a0b (diff)
parentfd55a4e1d049748634e6d802ca124cb67596cd52 (diff)
downloadnova-0cec0a78a5bfca24b5cadda8fb5cdc9d9db91c3d.tar.gz
nova-0cec0a78a5bfca24b5cadda8fb5cdc9d9db91c3d.tar.xz
nova-0cec0a78a5bfca24b5cadda8fb5cdc9d9db91c3d.zip
Merge "Improve Keypair error messages in osapi"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/keypairs.py10
-rw-r--r--nova/api/openstack/compute/plugins/v3/keypairs.py10
2 files changed, 8 insertions, 12 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py
index a79b39aae..4245355e5 100644
--- a/nova/api/openstack/compute/contrib/keypairs.py
+++ b/nova/api/openstack/compute/contrib/keypairs.py
@@ -94,12 +94,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):
"""
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):
"""