diff options
Diffstat (limited to 'functest/utils/openstack_utils.py')
-rw-r--r-- | functest/utils/openstack_utils.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index 3e27d672..a50bf179 100644 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py @@ -181,14 +181,10 @@ def get_endpoint(service_type, endpoint_type='publicURL'): def get_session(other_creds={}): auth = get_session_auth(other_creds) - cacert = os.getenv('OS_CACERT') - if cacert is not None: - if not os.path.isfile(cacert): - raise Exception("The 'OS_CACERT' environment" - "variable is set to %s but the file" - "does not exist.", cacert) - - return session.Session(auth=auth, verify=cacert) + https_cacert = os.getenv('OS_CACERT', '') + https_insecure = os.getenv('OS_INSECURE', '').lower() == 'true' + return session.Session(auth=auth, + verify=(https_cacert or not https_insecure)) # ********************************************* @@ -426,12 +422,12 @@ def get_or_create_flavor(flavor_name, ram, disk, vcpus, public=True): return flavor_exists, flavor_id -def get_floating_ips(nova_client): +def get_floating_ips(neutron_client): try: - floating_ips = nova_client.floating_ips.list() - return floating_ips + floating_ips = neutron_client.list_floatingips() + return floating_ips['floatingips'] except Exception as e: - logger.error("Error [get_floating_ips(nova_client)]: %s" % e) + logger.error("Error [get_floating_ips(neutron_client)]: %s" % e) return None @@ -594,12 +590,12 @@ def delete_instance(nova_client, instance_id): return False -def delete_floating_ip(nova_client, floatingip_id): +def delete_floating_ip(neutron_client, floatingip_id): try: - nova_client.floating_ips.delete(floatingip_id) + neutron_client.delete_floatingip(floatingip_id) return True except Exception as e: - logger.error("Error [delete_floating_ip(nova_client, '%s')]: %s" + logger.error("Error [delete_floating_ip(neutron_client, '%s')]: %s" % (floatingip_id, e)) return False |