Close session at clean_up if available

To avoid unclosed socket[1] left overs, explicitly
close session at clean_up if available.

[1] sys:1: ResourceWarning: unclosed <socket.socket fd=4>

Story: 2009015
Task: 42735
Related-Bug: #1934098
Change-Id: Idf4865686c37f6f9f61d1f3333b976cc687de9e1
This commit is contained in:
yatinkarel 2021-06-30 14:24:04 +05:30
parent dd75c8fdbf
commit 97c578bcad

View File

@ -499,6 +499,10 @@ class OpenStackShell(app.App):
if hasattr(self.client_manager, "sdk_connection"): if hasattr(self.client_manager, "sdk_connection"):
self.client_manager.sdk_connection.close() self.client_manager.sdk_connection.close()
# Close session if available
if hasattr(self.client_manager.session, "session"):
self.client_manager.session.session.close()
# Process collected timing data # Process collected timing data
if self.options.timing: if self.options.timing:
# Get session data # Get session data