diff options
author | Shobhi Jain <shobhi.jain@intel.com> | 2018-03-27 16:47:04 +0100 |
---|---|---|
committer | Shobhi Jain <shobhi.jain@intel.com> | 2018-04-23 13:10:03 +0000 |
commit | aded0fdb30caf035e0eb94c1216f436ba597c2c7 (patch) | |
tree | 08e0028de88edf88bfd7d8377a18d551d84efde2 /yardstick/common/openstack_utils.py | |
parent | c1ab98526209a761a0565afa7ccd552ba9ac7ade (diff) |
Replace nova delete keypair with shade client.
Function delete_keypair now uses shade client.
JIRA: YARDSTICK-1088
Change-Id: I46b895748c5c44b0bf7d5b035395676ebff48d7f
Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/common/openstack_utils.py')
-rw-r--r-- | yardstick/common/openstack_utils.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index e79c98872..0902d29e1 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -348,12 +348,18 @@ def delete_flavor(flavor_id): # pragma: no cover return True -def delete_keypair(nova_client, key): # pragma: no cover +def delete_keypair(shade_client, name): + """Delete a keypair. + + :param name: Name of the keypair to delete. + + :returns: True if delete succeeded, False otherwise. + """ try: - nova_client.keypairs.delete(key=key) - return True - except Exception: # pylint: disable=broad-except - log.exception("Error [delete_keypair(nova_client)]") + return shade_client.delete_keypair(name) + except exc.OpenStackCloudException as o_exc: + log.error("Error [delete_neutron_router(shade_client, '%s')]. " + "Exception message: %s", name, o_exc.orig_message) return False |