summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-02 22:38:25 +0000
committerGerrit Code Review <review@openstack.org>2012-02-02 22:38:25 +0000
commit6990b93ee6d8e0b239d1338242c111bbc3d7563d (patch)
treebb9e44fde02e81dc0f49aa5fd16052ef00b878e6 /nova/api
parent72d2411aa0932d20c11ed2fff4422d28b4681151 (diff)
parent999db21e1a5a0944535e0fb0fd2478ab1647d85b (diff)
Merge "Throw an user error on creating duplicate keypairs Fixes bug 902162"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/keypairs.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/keypairs.py b/nova/api/openstack/compute/contrib/keypairs.py
index 57ac48dbc..0e8a4bb06 100644
--- a/nova/api/openstack/compute/contrib/keypairs.py
+++ b/nova/api/openstack/compute/contrib/keypairs.py
@@ -87,7 +87,8 @@ class KeypairController(object):
# NOTE(ja): generation is slow, so shortcut invalid name exception
try:
db.key_pair_get(context, context.user_id, name)
- raise exception.KeyPairExists(key_name=name)
+ msg = _("Key pair '%s' already exists.") % name
+ raise webob.exc.HTTPConflict(explanation=msg)
except exception.NotFound:
pass