summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-03-26 19:51:12 +0000
committerGerrit Code Review <review@openstack.org>2021-03-26 19:51:12 +0000
commitf6d147e03155789642b7c024ee7b655edbc35a29 (patch)
tree7509ef678bd52a1ec39b303cd916c07e5f360619
parent7a1dca4131eac16d817a891cf722069aa328383e (diff)
parent3140fe014a181185cef674d78dcdb169bb94783b (diff)
downloadpython-neutronclient-f6d147e03155789642b7c024ee7b655edbc35a29.tar.gz
Merge "Support passing mTLS certificate/key to HTTPClient"
-rw-r--r--neutronclient/client.py10
-rw-r--r--neutronclient/v2_0/client.py4
2 files changed, 11 insertions, 3 deletions
diff --git a/neutronclient/client.py b/neutronclient/client.py
index 936d297..e25f575 100644
--- a/neutronclient/client.py
+++ b/neutronclient/client.py
@@ -61,9 +61,9 @@ class HTTPClient(object):
token=None, region_name=None, timeout=None,
endpoint_url=None, insecure=False,
endpoint_type='publicURL',
- auth_strategy='keystone', ca_cert=None, log_credentials=False,
- service_type='network', global_request_id=None,
- **kwargs):
+ auth_strategy='keystone', ca_cert=None, cert=None,
+ log_credentials=False, service_type='network',
+ global_request_id=None, **kwargs):
self.username = username
self.user_id = user_id
@@ -82,6 +82,7 @@ class HTTPClient(object):
self.auth_strategy = auth_strategy
self.log_credentials = log_credentials
self.global_request_id = global_request_id
+ self.cert = cert
if insecure:
self.verify_cert = False
else:
@@ -167,6 +168,7 @@ class HTTPClient(object):
data=body,
headers=headers,
verify=self.verify_cert,
+ cert=self.cert,
timeout=self.timeout,
**kwargs)
@@ -399,6 +401,7 @@ def construct_http_client(username=None,
log_credentials=None,
auth_strategy='keystone',
ca_cert=None,
+ cert=None,
service_type='network',
session=None,
global_request_id=None,
@@ -430,6 +433,7 @@ def construct_http_client(username=None,
endpoint_type=endpoint_type,
service_type=service_type,
ca_cert=ca_cert,
+ cert=cert,
log_credentials=log_credentials,
auth_strategy=auth_strategy,
global_request_id=global_request_id)
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py
index ff44064..c264dfd 100644
--- a/neutronclient/v2_0/client.py
+++ b/neutronclient/v2_0/client.py
@@ -216,6 +216,10 @@ class ClientBase(object):
:param bool log_credentials: Allow for logging of passwords or not.
Defaults to False. (optional)
:param string ca_cert: SSL CA bundle file to use. (optional)
+ :param cert: A client certificate to pass to requests. These are of the
+ same form as requests expects. Either a single filename
+ containing both the certificate and key or a tuple containing
+ the path to the certificate then a path to the key. (optional)
:param integer retries: How many times idempotent (GET, PUT, DELETE)
requests to Neutron server should be retried if
they fail (default: 0).