From edd6d4cadadf8c84bb212b1108c0b89ce535a19b Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Fri, 10 Mar 2017 10:43:28 +0000 Subject: 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 (cherry picked from commit 747e3c5f8a882b07b6876aae61c84d05a8b832f4) --- yardstick/common/openstack_utils.py | 21 ++++++--------------- 1 file 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'): -- cgit 1.2.3-korg