X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcommon%2Fopenstack_utils.py;h=8787e605a8f087bf7c4d23d4fc021b36f70a3902;hb=dae41a002f756d1da65a749bc82eef3ccf4252db;hp=aa369b8965d908cca2ad162a477c4e4cd4dea3c6;hpb=5699a278956c9deeafb3ec483689d07019048159;p=yardstick.git diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index aa369b896..8787e605a 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -62,20 +62,6 @@ def get_credentials(): "project_domain_name": os.getenv('OS_PROJECT_DOMAIN_NAME') }) - cacert = os.environ.get("OS_CACERT") - - if cacert is not None: - # each openstack client uses differnt kwargs for this - creds.update({"cacert": cacert, - "ca_cert": cacert, - "https_ca_cert": cacert, - "https_cacert": cacert, - "ca_file": cacert}) - creds.update({"insecure": "True", "https_insecure": "True"}) - if not os.path.isfile(cacert): - log.info("WARNING: The 'OS_CACERT' environment variable is set \ - to %s but the file does not exist.", cacert) - return creds @@ -88,14 +74,25 @@ def get_session_auth(): def get_session(): auth = get_session_auth() - return session.Session(auth=auth) + try: + cacert = os.environ['OS_CACERT'] + except KeyError: + return session.Session(auth=auth) + else: + insecure = os.getenv('OS_INSECURE', '').lower() == 'true' + cacert = False if insecure else cacert + return session.Session(auth=auth, verify=cacert) def get_endpoint(service_type, endpoint_type='publicURL'): auth = get_session_auth() + # for multi-region, we need to specify region + # when finding the endpoint return get_session().get_endpoint(auth=auth, service_type=service_type, - endpoint_type=endpoint_type) + endpoint_type=endpoint_type, + region_name=os.environ.get( + "OS_REGION_NAME")) # *********************************************