Add check for sdk_connection

This change checks if the attribute sdk_connection exists
before attempting to close it. Without this change we're
seeing the following exception:

> Could not clean up: 'ClientManager' object has no attribute 'sdk_connection'

Related-Change: https://review.opendev.org/c/openstack/osc-lib/+/765650
Signed-off-by: Kevin Carter <kecarter@redhat.com>
Change-Id: Ib7e9958d5a64e6500bc38eed9d3e783d5a48d21f
This commit is contained in:
Kevin Carter 2021-05-19 13:23:05 -05:00
parent 1354890f0b
commit dd75c8fdbf
1 changed files with 1 additions and 1 deletions

View File

@ -496,7 +496,7 @@ class OpenStackShell(app.App):
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:
if hasattr(self.client_manager, "sdk_connection"):
self.client_manager.sdk_connection.close()
# Process collected timing data