X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Finfra_setup%2Fheat%2Fcommon.py;h=f0512b0f817460d5aa5944c970aa4962ee14249f;hb=2822554647c906a1bdaa0b1661cbd8416e2fd7ef;hp=28257ac71084a2faf31438a2f9f59cfb5b933289;hpb=5c859330549de91739b7c2ef31c040a208bb6840;p=bottlenecks.git diff --git a/utils/infra_setup/heat/common.py b/utils/infra_setup/heat/common.py index 28257ac7..f0512b0f 100755 --- a/utils/infra_setup/heat/common.py +++ b/utils/infra_setup/heat/common.py @@ -54,20 +54,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 @@ -80,7 +66,16 @@ def get_session_auth(): def get_session(): auth = get_session_auth() - return session.Session(auth=auth) + if os.getenv('OS_INSECURE', '').lower() == 'true': + cacert = False + return session.Session(auth=auth, verify=cacert) + else: + try: + cacert = os.environ['OS_CACERT'] + except KeyError: + return session.Session(auth=auth) + else: + return session.Session(auth=auth, verify=cacert) def get_endpoint(service_type, endpoint_type='publicURL'): @@ -97,6 +92,7 @@ def get_heat_api_version(): return api_version return DEFAULT_HEAT_API_VERSION + def get_nova_api_version(): api_version = os.getenv('OS_COMPUTE_API_VERSION') if api_version is not None: @@ -110,4 +106,4 @@ def get_glance_api_version(): if api_version is not None: log.info("GLANCE_API_VERSION is set in env as '%s'", api_version) return api_version - return DEFAULT_GLANCE_API_VERSION \ No newline at end of file + return DEFAULT_GLANCE_API_VERSION