From 999db21e1a5a0944535e0fb0fd2478ab1647d85b Mon Sep 17 00:00:00 2001 From: Nirmal Ranganathan Date: Thu, 2 Feb 2012 14:19:57 -0600 Subject: Throw an user error on creating duplicate keypairs Fixes bug 902162 Change-Id: I1b73943aab338bde90b4d47bc015964e9981af5d --- nova/api/openstack/compute/contrib/keypairs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') 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 -- cgit