Add support for SDK auth caching
SDK starts caching authorization state in keyring (when available and enabled). Respecting it requires few minor changes: closing connection and reusing auth_ref. Depends-On: https://review.opendev.org/c/openstack/openstacksdk/+/735352 Change-Id: I7b7cff4887ec77e4c9d98809150d9064eedafaf6
This commit is contained in:
parent
239b001a14
commit
25011a09df
@ -168,6 +168,10 @@ class ClientManager(object):
|
||||
|
||||
self.sdk_connection = connection.Connection(config=self._cli_options)
|
||||
|
||||
# We might get auth_ref from SDK cacnihg
|
||||
if hasattr(self.auth, 'auth_ref') and self.auth.auth_ref:
|
||||
self._auth_ref = self.auth.auth_ref
|
||||
|
||||
self._auth_setup_completed = True
|
||||
|
||||
def validate_scope(self):
|
||||
|
@ -495,6 +495,10 @@ class OpenStackShell(app.App):
|
||||
def clean_up(self, cmd, result, err):
|
||||
self.log.debug('clean_up %s: %s', cmd.__class__.__name__, err or '')
|
||||
|
||||
# Close SDK connection if available to have proper cleanup there
|
||||
if self.client_manager.sdk_connection:
|
||||
self.client_manager.sdk_connection.close()
|
||||
|
||||
# Process collected timing data
|
||||
if self.options.timing:
|
||||
# Get session data
|
||||
|
Loading…
x
Reference in New Issue
Block a user