summaryrefslogtreecommitdiff
path: root/nova/api
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-25 01:48:58 +0000
committerGerrit Code Review <review@openstack.org>2022-02-25 01:48:58 +0000
commit1c20ee250c66216c3940206c2c3740ff8dab7cfa (patch)
treeec7ac67a98e352eee1e65bcf36194f9e187b6f20 /nova/api
parentd8118954416dae2385978cfcaf704bf539dbc49c (diff)
parent78f02e96eddd92d7a5eb5d793b6646f0e86ab272 (diff)
downloadnova-1c20ee250c66216c3940206c2c3740ff8dab7cfa.tar.gz
Merge "Move keypair quota error message into exception"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/keypairs.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/nova/api/openstack/compute/keypairs.py b/nova/api/openstack/compute/keypairs.py
index 1fa1684322..65dacfa638 100644
--- a/nova/api/openstack/compute/keypairs.py
+++ b/nova/api/openstack/compute/keypairs.py
@@ -26,7 +26,6 @@ from nova.api.openstack import wsgi
from nova.api import validation
from nova.compute import api as compute_api
from nova import exception
-from nova.i18n import _
from nova.objects import keypair as keypair_obj
from nova.policies import keypairs as kp_policies
@@ -119,9 +118,8 @@ class KeypairController(wsgi.Controller):
context, user_id, name, key_type_value)
keypair['private_key'] = private_key
return_priv_key = True
- except exception.KeypairLimitExceeded:
- msg = _("Quota exceeded, too many key pairs.")
- raise webob.exc.HTTPForbidden(explanation=msg)
+ except exception.KeypairLimitExceeded as e:
+ raise webob.exc.HTTPForbidden(explanation=str(e))
except exception.InvalidKeypair as exc:
raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
except exception.KeyPairExists as exc: