Blame SOURCES/sos-bz1087977-sosreport-do-not-make-logging-calls-after-oserror.patch

e75bc7
From ed44939d5988098feb3f3ddededd68a0a4b9a9df Mon Sep 17 00:00:00 2001
e75bc7
From: "Bryn M. Reeves" <bmr@redhat.com>
e75bc7
Date: Tue, 13 Jan 2015 17:26:33 +0000
e75bc7
Subject: [PATCH] [sosreport] do not make logging calls after OSError
e75bc7
e75bc7
Following an OSError during archive setup the logging subsystem
e75bc7
is potentially in an inconsistent or unusable state (e.g. due to
e75bc7
a readonly file system error).
e75bc7
e75bc7
Use the print function directly since we just need to report the
e75bc7
error and exit.
e75bc7
e75bc7
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
e75bc7
---
e75bc7
 sos/sosreport.py | 9 ++++++---
e75bc7
 1 file changed, 6 insertions(+), 3 deletions(-)
e75bc7
e75bc7
diff --git a/sos/sosreport.py b/sos/sosreport.py
e75bc7
index 2a16555..3c0397c 100644
e75bc7
--- a/sos/sosreport.py
e75bc7
+++ b/sos/sosreport.py
e75bc7
@@ -1091,10 +1091,13 @@ class SoSReport(object):
e75bc7
             self._make_archive_paths()
e75bc7
             return
e75bc7
         except (OSError, IOError) as e:
e75bc7
+            # we must not use the logging subsystem here as it is potentially
e75bc7
+            # in an inconsistent or unreliable state (e.g. an EROFS for the
e75bc7
+            # file system containing our temporary log files).
e75bc7
             if e.errno in fatal_fs_errors:
e75bc7
-                self.ui_log.error("")
e75bc7
-                self.ui_log.error(" %s while setting up archive" % e.strerror)
e75bc7
-                self.ui_log.error("")
e75bc7
+                print("")
e75bc7
+                print(" %s while setting up archive" % e.strerror)
e75bc7
+                print("")
e75bc7
             else:
e75bc7
                 raise e
e75bc7
         except Exception as e:
e75bc7
-- 
e75bc7
1.9.3
e75bc7