diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2022-01-10 14:17:13 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-01-10 09:37:50 -0500 |
commit | 0c67e8ebaeef17dac3b5b9e42a59b4e673e4403b (patch) | |
tree | d798ab63953aa7b8ca22f9d4ec230cebf924b2fe | |
parent | f912fc9e31b406a24b7a9c012e12cda920632051 (diff) | |
download | sos-0c67e8ebaeef17dac3b5b9e42a59b4e673e4403b.tar.gz |
[collector] Cleanup cluster only if defined
In case cluster init fails, self.cluster = None and its cleanup
must be skipped.
Resolves: #2822
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/collector/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py index ffd63bc6..3e22bca3 100644 --- a/sos/collector/__init__.py +++ b/sos/collector/__init__.py @@ -443,7 +443,8 @@ class SoSCollector(SoSComponent): def exit(self, msg, error=1): """Used to safely terminate if sos-collector encounters an error""" - self.cluster.cleanup() + if self.cluster: + self.cluster.cleanup() self.log_error(msg) try: self.close_all_connections() |