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
changes/52/765652/1
Artem Goncharov 2 years ago
parent d0fd1ffe0a
commit 30d5f14a70
  1. 10
      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)

Loading…
Cancel
Save