From: Yang (Gabriel) Yu Date: Fri, 27 Jul 2018 02:17:25 +0000 (+0800) Subject: bug-fix: insecure option for quota setting X-Git-Tag: ovp-2.0.0~4 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?p=bottlenecks.git;a=commitdiff_plain;h=7c9dcafa5f13e56a3edc8276e8cbc9cc6fd3e98c bug-fix: insecure option for quota setting JIRA: BOTTLENECK-240 Setting quotas will raise exception if either of insecure and os_cacert are not set. It is not resonable. Change-Id: Ie97f0580624a6d539e9c4cfe799714090a288487 Signed-off-by: Yang (Gabriel) Yu (cherry picked from commit 2822554647c906a1bdaa0b1661cbd8416e2fd7ef) --- diff --git a/utils/infra_setup/heat/common.py b/utils/infra_setup/heat/common.py index a0d6d83c..f0512b0f 100755 --- a/utils/infra_setup/heat/common.py +++ b/utils/infra_setup/heat/common.py @@ -66,14 +66,16 @@ def get_session_auth(): def get_session(): auth = get_session_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 + 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'):