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
This commit is contained in:
Artem Goncharov 2020-12-05 15:40:24 +01:00
parent d0fd1ffe0a
commit 30d5f14a70
1 changed files with 6 additions and 4 deletions

View File

@ -83,6 +83,8 @@ class ClientManager(clientmanager.ClientManager):
self._cli_options._openstack_config._pw_callback = \
shell.prompt_for_password
try:
# 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,