summaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
authorhelenyao <yaohelan@huawei.com>2017-03-10 20:23:42 +0800
committerJose Lausuch <jose.lausuch@ericsson.com>2017-03-23 17:31:57 +0000
commit809c47d502e5a687e122685cb512ff686189da2f (patch)
treea07cdc543526d57e79c848f23a0d37eab7913973 /functest/utils
parenta8fb7f54736e44f721483e3f455fd3e2084e6a36 (diff)
Support running on openstack which enabled https
JIRA: FUNCTEST-757 Change-Id: Ic87bee3020b9714bcd83105127440a9c1a7ff2ad Signed-off-by: helenyao <yaohelan@huawei.com> (cherry picked from commit 4a989722feca53e1baa6f64985841bd6a244d627)
Diffstat (limited to 'functest/utils')
-rwxr-xr-xfunctest/utils/openstack_utils.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index e33af63b4..ffc870f62 100755
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -82,7 +82,8 @@ def get_env_cred_dict():
'OS_PROJECT_DOMAIN_NAME': 'project_domain_name',
'OS_PROJECT_NAME': 'project_name',
'OS_ENDPOINT_TYPE': 'endpoint_type',
- 'OS_REGION_NAME': 'region_name'
+ 'OS_REGION_NAME': 'region_name',
+ 'OS_CACERT': 'https_cacert'
}
return env_cred_dict
@@ -149,6 +150,11 @@ def get_credentials_for_rally():
if region_name is not None:
cred_key = env_cred_dict.get('OS_REGION_NAME')
rally_conf[cred_key] = region_name
+
+ cacert = os.getenv('OS_CACERT')
+ if cacert is not None:
+ cred_key = env_cred_dict.get('OS_CACERT')
+ rally_conf[cred_key] = cacert
return rally_conf
@@ -168,7 +174,14 @@ def get_endpoint(service_type, endpoint_type='publicURL'):
def get_session(other_creds={}):
auth = get_session_auth(other_creds)
- return session.Session(auth=auth)
+ cacert = os.getenv('OS_CACERT')
+ if cacert is not None:
+ if not os.path.isfile(cacert):
+ raise Exception("The 'OS_CACERT' environment"
+ "variable is set to %s but the file"
+ "does not exist.", cacert)
+
+ return session.Session(auth=auth, verify=cacert)
# *********************************************