summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-07-27 10:17:25 +0800
committerYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-07-27 10:17:25 +0800
commit2822554647c906a1bdaa0b1661cbd8416e2fd7ef (patch)
tree623f08cb5084f966756083057cb33c79668d7311
parentad12a6561be8c67f6da09c38c4e1c0e88eb9a6de (diff)
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 <Gabriel.yuyang@huawei.com>
-rwxr-xr-xutils/infra_setup/heat/common.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/infra_setup/heat/common.py b/utils/infra_setup/heat/common.py
index a0d6d83..f0512b0 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'):