diff options
| author | Cedric Brandily <zzelle@gmail.com> | 2016-04-01 23:42:27 +0200 |
|---|---|---|
| committer | Cedric Brandily <zzelle@gmail.com> | 2016-04-06 20:21:19 +0200 |
| commit | 3a8320a1d73444b3bb823300e94c3e2ee85fd6ef (patch) | |
| tree | 0a1411808f658233f91a2e68f8c5ffbb0d0c5ac7 /openstackclient/common/clientmanager.py | |
| parent | a1a470693e264e991b1dc9497512769bb8d510d8 (diff) | |
| download | python-openstackclient-3a8320a1d73444b3bb823300e94c3e2ee85fd6ef.tar.gz | |
Support client certificate/key
This change enables to specify a client certificate/key with:
* usual CLI options (--os-cert/--os-key)
* usual environment variables ($OS_CERT/$OS_KEY)
* os-client-config
Change-Id: Ibeaaa5897ae37b37c1e91f3e47076e4e8e4a8ded
Closes-Bug: #1565112
Diffstat (limited to 'openstackclient/common/clientmanager.py')
| -rw-r--r-- | openstackclient/common/clientmanager.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 56ddcbad..6d23b55e 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -110,6 +110,15 @@ class ClientManager(object): self._cacert = verify self._insecure = False + # Set up client certificate and key + # NOTE(cbrandily): This converts client certificate/key to requests + # cert argument: None (no client certificate), a path + # to client certificate or a tuple with client + # certificate/key paths. + self._cert = self._cli_options.cert + if self._cert and self._cli_options.key: + self._cert = self._cert, self._cli_options.key + # Get logging from root logger root_logger = logging.getLogger('') LOG.setLevel(root_logger.getEffectiveLevel()) @@ -194,6 +203,7 @@ class ClientManager(object): auth=self.auth, session=request_session, verify=self._verify, + cert=self._cert, user_agent=USER_AGENT, ) |
