summaryrefslogtreecommitdiffstats
path: root/dovetail/utils
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2018-02-12 02:17:28 -0500
committerGeorg Kunz <georg.kunz@ericsson.com>2018-02-16 17:05:10 +0000
commit51a7666d0d50d0ed13c556d97aded50a3e7f30de (patch)
treeb1fe507497ccb03439996501aae63b51e0f585f9 /dovetail/utils
parent18f117ce3b88ef626f6de5e5037e220be0f0f0ac (diff)
Add a function to check the cacert file
1. Currently it won't pass the cacert file to other containers if the OS_AUTH_URL is http not https. 2. However, even though the OS_AUTH_URL is http, it still needs cacert file somewhere for Functest and Rally. 3. This problem is found on Fuel Euphrates. 4. Add a function to check whether the cacert file exists. 5. If exists, pass it to testing project containers. JIRA: DOVETAIL-616 Change-Id: Ied7bcc72e8f1c738bbce32c18096ca13641d3cd7 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/utils')
-rw-r--r--dovetail/utils/dovetail_utils.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py
index 5c335679..97186da0 100644
--- a/dovetail/utils/dovetail_utils.py
+++ b/dovetail/utils/dovetail_utils.py
@@ -139,9 +139,9 @@ def get_ext_net_name(env_file, logger=None):
else:
https_enabled = check_https_enabled(logger)
insecure_option = ''
- insecure = os.getenv('OS_INSECURE',)
+ insecure = os.getenv('OS_INSECURE')
if https_enabled:
- logger.info("https enabled...")
+ logger.debug("https enabled...")
if insecure:
if insecure.lower() == "true":
insecure_option = ' --insecure '
@@ -311,7 +311,7 @@ def combine_files(file_path, result_file, logger=None):
def get_openstack_endpoint(logger=None):
https_enabled = check_https_enabled(logger)
insecure_option = ''
- insecure = os.getenv('OS_INSECURE',)
+ insecure = os.getenv('OS_INSECURE')
if https_enabled:
if insecure:
if insecure.lower() == "true":
@@ -333,3 +333,16 @@ def get_openstack_endpoint(logger=None):
except Exception:
logger.exception("Failed to write endpoint info into file.")
return None
+
+
+def check_cacert_file(cacert, logger=None):
+ if not os.path.isfile(cacert):
+ logger.error("OS_CACERT is {}, but the file does not exist."
+ .format(cacert))
+ return False
+ if not dt_cfg.dovetail_config['config_dir'] == os.path.dirname(cacert):
+ logger.error("Credential file must be put under {}, "
+ "which can be mounted into other container."
+ .format(dt_cfg.dovetail_config['config_dir']))
+ return False
+ return True