aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-03-10 10:43:28 +0000
committerJack Chan <chenjiankun1@huawei.com>2017-03-13 06:22:17 +0000
commitedd6d4cadadf8c84bb212b1108c0b89ce535a19b (patch)
tree4216b6f2ade87b627935b4bee9f21598b0af1072
parent34ec55f5007b7da43101ee9dd5f40ebaa0bb6234 (diff)
Bugfix: yardstick https support
JIRA: YARDSTICK-587 When run in https environment, there is a bug: error: failed to deploy stack: '_init_() got an unexpected keyword argument 'ca_cert'' The reason is the key pass to Session() is cacert, but the key should be verify. Change-Id: Ia9fc1d7908c2fca9d827a5f64deac7cd333d5c07 Signed-off-by: chenjiankun <chenjiankun1@huawei.com> (cherry picked from commit 747e3c5f8a882b07b6876aae61c84d05a8b832f4)
-rw-r--r--yardstick/common/openstack_utils.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index aa369b896..2df8fa565 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -62,20 +62,6 @@ def get_credentials():
"project_domain_name": os.getenv('OS_PROJECT_DOMAIN_NAME')
})
- cacert = os.environ.get("OS_CACERT")
-
- if cacert is not None:
- # each openstack client uses differnt kwargs for this
- creds.update({"cacert": cacert,
- "ca_cert": cacert,
- "https_ca_cert": cacert,
- "https_cacert": cacert,
- "ca_file": cacert})
- creds.update({"insecure": "True", "https_insecure": "True"})
- if not os.path.isfile(cacert):
- log.info("WARNING: The 'OS_CACERT' environment variable is set \
- to %s but the file does not exist.", cacert)
-
return creds
@@ -88,7 +74,12 @@ def get_session_auth():
def get_session():
auth = get_session_auth()
- return session.Session(auth=auth)
+ 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'):