diff options
| author | Artem Goncharov <Artem.goncharov@gmail.com> | 2020-12-05 15:40:24 +0100 |
|---|---|---|
| committer | Artem Goncharov <Artem.goncharov@gmail.com> | 2020-12-05 15:40:24 +0100 |
| commit | 30d5f14a700dd53d80e0fbedefd9b1ad337390f9 (patch) | |
| tree | bcc13c5b2067d62ac1f0c8960a07020ff87d58e0 /openstackclient | |
| parent | d0fd1ffe0a48d02a12c07a1254c1b3db2caca6d7 (diff) | |
| download | python-openstackclient-30d5f14a700dd53d80e0fbedefd9b1ad337390f9.tar.gz | |
Add support for token caching
SDK starts caching token in keyring (when available and configured). A
small change is required in OSC not to reject this state.
Overall this helps avoiding reauthentication upon next openstack call.
If token is not valid anymore automatically reauthentication is done.
Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/735352
Depends-On: https://review.opendev.org/c/openstack/osc-lib/+/765650
Change-Id: I47261a32bd3b106a589974d3de5bf2a6ebd57263
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/common/clientmanager.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 36c3ce26..1ed6aa24 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -83,10 +83,12 @@ class ClientManager(clientmanager.ClientManager): self._cli_options._openstack_config._pw_callback = \ shell.prompt_for_password try: - self._cli_options._auth = \ - self._cli_options._openstack_config.load_auth_plugin( - self._cli_options.config, - ) + # We might already get auth from SDK caching + if not self._cli_options._auth: + self._cli_options._auth = \ + self._cli_options._openstack_config.load_auth_plugin( + self._cli_options.config, + ) except TypeError as e: self._fallback_load_auth_plugin(e) |
