diff options
author | Jose Castillo <jcastillo@redhat.com> | 2022-05-12 14:15:54 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-05-23 14:54:23 -0400 |
commit | bf9462a5361991fb6d28471a049123f7b8e15093 (patch) | |
tree | 6901530afd022574557dff8e02cad758feaebd1c | |
parent | eba378f1b304951479932b391e60c70749b541bb (diff) | |
download | sos-bf9462a5361991fb6d28471a049123f7b8e15093.tar.gz |
[sos] Fix unhandled exception when concurrently removing temp dir
This patch tries to capture the exception when running
the sosreport at the same time the temp directory
specified as an option is deleted.
Resolves: #2806
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
-rw-r--r-- | sos/report/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sos/report/__init__.py b/sos/report/__init__.py index 8735c903..b9e6620f 100644 --- a/sos/report/__init__.py +++ b/sos/report/__init__.py @@ -1453,9 +1453,14 @@ class SoSReport(SoSComponent): if not archive: print("Creating archive tarball failed.") else: - # compute and store the archive checksum - hash_name = self.policy.get_preferred_hash_name() - checksum = self._create_checksum(archive, hash_name) + try: + # compute and store the archive checksum + hash_name = self.policy.get_preferred_hash_name() + checksum = self._create_checksum(archive, hash_name) + except Exception: + print(_("Error generating archive checksum after " + "archive creation.\n")) + return False try: self._write_checksum(archive, hash_name, checksum) except (OSError, IOError): |