From dd75c8fdbf1662928038103f199d66141107c569 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Wed, 19 May 2021 13:23:05 -0500 Subject: [PATCH] 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 Change-Id: Ib7e9958d5a64e6500bc38eed9d3e783d5a48d21f --- osc_lib/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osc_lib/shell.py b/osc_lib/shell.py index 9b2061c..fea4c75 100644 --- a/osc_lib/shell.py +++ b/osc_lib/shell.py @@ -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