From 13fd37932452874f7dad7e4bb2230cf6f16073e7 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 9 Jul 2012 11:40:10 -0400 Subject: 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 --- nova/compute/api.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'nova') 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 -- cgit