summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-07-09 11:40:10 -0400
committerDan Prince <dprince@redhat.com>2012-07-09 13:35:18 -0400
commit13fd37932452874f7dad7e4bb2230cf6f16073e7 (patch)
tree05a19a370d1a9d9eb13e8b99164d31d8a3f3f3e8
parenta97de51e017c9c07eaa3e4a9ddde4193e9528373 (diff)
Fix KeyError 'key_name' when KeyPairExists raised.
Updates the Nova compute API to pass a key_name arg to the KeyPairExists constructor. This fixes an issue where a KeyError exception would get logged to Nova's api.log file if a KeyPairExists exception was thrown. Also removes the un-needed exception explanation argument from the KeyPairExists constructor. Fixes LP Bug #1022611 Change-Id: I83ecf3d392fef97649b298d1b732e1ff51145ae4
-rw-r--r--nova/compute/api.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 70528271f..a8e9840aa 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1828,8 +1828,7 @@ class KeypairAPI(base.Base):
# NOTE: check for existing keypairs of same name
try:
self.db.key_pair_get(context, user_id, key_name)
- msg = _("Key pair '%s' already exists.") % key_name
- raise exception.KeyPairExists(explanation=msg)
+ raise exception.KeyPairExists(key_name=key_name)
except exception.NotFound:
pass