Blob Blame History Raw
From ed44939d5988098feb3f3ddededd68a0a4b9a9df Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Tue, 13 Jan 2015 17:26:33 +0000
Subject: [PATCH 38/93] [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>
---
 sos/sosreport.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2a16555..3c0397c 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:
-- 
1.9.3