Skip to content

Commit

Permalink
Add cluster cleanup for all exit() calls
Browse files Browse the repository at this point in the history
Signed-off-by: Nadia Pinaeva <[email protected]>
  • Loading branch information
npinaeva authored and TurboTurtle committed Jan 5, 2022
1 parent ddf9eaa commit 304c9ef
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sos/collector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ def add_parser_options(cls, parser):

def exit(self, msg, error=1):
"""Used to safely terminate if sos-collector encounters an error"""
self.cluster.cleanup()
self.log_error(msg)
try:
self.close_all_connections()
Expand Down Expand Up @@ -854,7 +855,6 @@ def display_nodes(self):
"CTRL-C to quit\n")
self.ui_log.info("")
except KeyboardInterrupt:
self.cluster.cleanup()
self.exit("Exiting on user cancel", 130)
except Exception as e:
self.exit(repr(e), 1)
Expand Down Expand Up @@ -1185,7 +1185,6 @@ def collect(self):
arc_name = self.create_cluster_archive()
else:
msg = 'No sosreports were collected, nothing to archive...'
self.cluster.cleanup()
self.exit(msg, 1)

if self.opts.upload and self.policy.get_upload_url():
Expand Down

0 comments on commit 304c9ef

Please sign in to comment.