aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-13 17:26:33 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-01-13 17:26:33 +0000
commited44939d5988098feb3f3ddededd68a0a4b9a9df (patch)
treecbd2b50af0e23b7bb1dee6b4c7f1ed8aad2e63df
parent95bb5df9eda253afed15fa81340d31e03c40fe94 (diff)
downloadsos-ed44939d5988098feb3f3ddededd68a0a4b9a9df.tar.gz
[sosreport] do not make logging calls after OSError
Following an OSError during archive setup the logging subsystem is potentially in an inconsistent or unusable state (e.g. due to a readonly file system error). Use the print function directly since we just need to report the error and exit. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/sosreport.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2a165559..3c0397cb 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -1091,10 +1091,13 @@ class SoSReport(object):
self._make_archive_paths()
return
except (OSError, IOError) as e:
+ # we must not use the logging subsystem here as it is potentially
+ # in an inconsistent or unreliable state (e.g. an EROFS for the
+ # file system containing our temporary log files).
if e.errno in fatal_fs_errors:
- self.ui_log.error("")
- self.ui_log.error(" %s while setting up archive" % e.strerror)
- self.ui_log.error("")
+ print("")
+ print(" %s while setting up archive" % e.strerror)
+ print("")
else:
raise e
except Exception as e: