summaryrefslogtreecommitdiffstats
path: root/dovetail/utils
diff options
context:
space:
mode:
authorhongbo tian <hongbo.tianhongbo@huawei.com>2017-06-28 09:09:14 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-28 09:09:14 +0000
commit6ddd0a92a137906ae0dd00468c5db556dda91555 (patch)
tree7359398c40be7b43eee7e066d93bc00c18ef9dd5 /dovetail/utils
parentc3e1d8cb6bb228058a152fdcdbd8dec0d2457748 (diff)
parent1fe13eec3f4fcc0c63555364b41db06bffb9978c (diff)
Merge "https enabled checking"
Diffstat (limited to 'dovetail/utils')
-rw-r--r--dovetail/utils/dovetail_utils.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py
index e4284ad4..aeb8ea00 100644
--- a/dovetail/utils/dovetail_utils.py
+++ b/dovetail/utils/dovetail_utils.py
@@ -118,14 +118,25 @@ def source_env(env_file):
os.environ.update({match[0]: match[1]})
+def check_https_enabled(logger=None):
+ logger.info("checking if https enabled or not...")
+ cmd = "openstack catalog show identity |awk '/public/ {print $4}'| \
+ grep 'https'"
+ ret, msg = exec_cmd(cmd, logger)
+ return ret
+
+
def get_ext_net_name(env_file, logger=None):
+ https_enabled = check_https_enabled(logger)
insecure_option = ''
insecure = os.getenv('OS_INSECURE',)
- if insecure == "true" or insecure == "True":
- insecure_option = ' --insecure '
- else:
- print "Warn: env variable OS_INSECUE is %s, if https+no credential \
- used, it should be set as true" % insecure
+ if https_enabled == 0:
+ logger.info("https enabled...")
+ if insecure.lower() == "true":
+ insecure_option = ' --insecure '
+ else:
+ logger.warn("env variable OS_INSECURE is %s, if https + no"
+ "credential used, should be set as True" % insecure)
cmd_check = "openstack %s network list" % insecure_option
ret, msg = exec_cmd(cmd_check, logger)