From 97c578bcadf24eec970f4b711aaf58d5c9e099c8 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Wed, 30 Jun 2021 14:24:04 +0530 Subject: [PATCH] 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 Story: 2009015 Task: 42735 Related-Bug: #1934098 Change-Id: Idf4865686c37f6f9f61d1f3333b976cc687de9e1 --- osc_lib/shell.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osc_lib/shell.py b/osc_lib/shell.py index fea4c75..bdc2a40 100644 --- a/osc_lib/shell.py +++ b/osc_lib/shell.py @@ -499,6 +499,10 @@ class OpenStackShell(app.App): if hasattr(self.client_manager, "sdk_connection"): 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 if self.options.timing: # Get session data