Skip to content

Commit 30d5f14

Browse files
committed
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
1 parent d0fd1ff commit 30d5f14

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

openstackclient/common/clientmanager.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ def setup_auth(self):
8383
self._cli_options._openstack_config._pw_callback = \
8484
shell.prompt_for_password
8585
try:
86-
self._cli_options._auth = \
87-
self._cli_options._openstack_config.load_auth_plugin(
88-
self._cli_options.config,
89-
)
86+
# We might already get auth from SDK caching
87+
if not self._cli_options._auth:
88+
self._cli_options._auth = \
89+
self._cli_options._openstack_config.load_auth_plugin(
90+
self._cli_options.config,
91+
)
9092
except TypeError as e:
9193
self._fallback_load_auth_plugin(e)
9294

0 commit comments

Comments
 (0)