summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-08-25 23:18:03 +0000
committerGerrit Code Review <review@openstack.org>2015-08-25 23:18:03 +0000
commitd5712e9a2d9c27499c15146d501e5303a7ec3207 (patch)
tree44512a88f8270ba8f59b564a8698f2a3b46c30b0
parent816da330cc5b20756b762c8712639be1ab66ccdd (diff)
parentafcf4a163ea841c71c66e2fe2d8a2e97e8a10912 (diff)
downloadpython-keystoneclient-d5712e9a2d9c27499c15146d501e5303a7ec3207.tar.gz
Merge "Deprecate use of cert and key"
-rw-r--r--keystoneclient/session.py15
-rw-r--r--keystoneclient/tests/unit/test_https.py6
2 files changed, 12 insertions, 9 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py
index 5ec8a67..e542edf 100644
--- a/keystoneclient/session.py
+++ b/keystoneclient/session.py
@@ -574,8 +574,11 @@ class Session(object):
verify = cacert or True
if cert and key:
- # passing cert and key together is deprecated in favour of the
- # requests lib form of having the cert and key as a tuple
+ warnings.warn(
+ 'Passing cert and key together is deprecated as of the 1.7.0 '
+ 'release in favor of the requests library form of having the '
+ 'cert and key as a tuple and may be removed in the 2.0.0 '
+ 'release.', DeprecationWarning)
cert = (cert, key)
return cls(verify=verify, cert=cert, **kwargs)
@@ -846,8 +849,8 @@ class Session(object):
kwargs['insecure'] = c.insecure
kwargs['cacert'] = c.cafile
- kwargs['cert'] = c.certfile
- kwargs['key'] = c.keyfile
+ if c.certfile and c.keyfile:
+ kwargs['cert'] = (c.certfile, c.keyfile)
kwargs['timeout'] = c.timeout
return cls._make(**kwargs)
@@ -904,8 +907,8 @@ class Session(object):
"""
kwargs['insecure'] = args.insecure
kwargs['cacert'] = args.os_cacert
- kwargs['cert'] = args.os_cert
- kwargs['key'] = args.os_key
+ if args.os_cert and args.os_key:
+ kwargs['cert'] = (args.os_cert, args.os_key)
kwargs['timeout'] = args.timeout
return cls._make(**kwargs)
diff --git a/keystoneclient/tests/unit/test_https.py b/keystoneclient/tests/unit/test_https.py
index bf93226..e04357a 100644
--- a/keystoneclient/tests/unit/test_https.py
+++ b/keystoneclient/tests/unit/test_https.py
@@ -29,7 +29,7 @@ RESPONSE_BODY = '{"hi": "there"}'
def get_client():
cl = httpclient.HTTPClient(username="username", password="password",
project_id="tenant", auth_url="auth_test",
- cacert="ca.pem", key="key.pem", cert="cert.pem")
+ cacert="ca.pem", cert=('cert.pem', "key.pem"))
return cl
@@ -85,8 +85,8 @@ class ClientTest(utils.TestCase):
MOCK_REQUEST.return_value = FAKE_RESPONSE
cl = httpclient.HTTPClient(
username="username", password="password", project_id="tenant",
- auth_url="auth_test", cacert="ca.pem", key="key.pem",
- cert="cert.pem")
+ auth_url="auth_test", cacert="ca.pem", cert=('cert.pem', 'key.pem')
+ )
cl.management_url = "https://127.0.0.1:5000"
cl.auth_token = "token"
with self.deprecations.expect_deprecations_here():