[rhel7/newui/master] Let kickstart users log to device nodes (#835563)

Brian C. Lane bcl at redhat.com
Tue Jun 26 18:48:05 UTC 2012


From: "Brian C. Lane" <bcl at redhat.com>

If a kickstart pre/post fails we read the logfile and add it to the
anaconda log. This doesn't work well for device nodes like /dev/console
so skip reading if it is a device node.

Resolves: rhbz#835563
---
 pyanaconda/kickstart.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index d3648e5..22f4481 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -87,7 +87,7 @@ class AnacondaKSScript(Script):
         # pick where it goes.  The script will also be logged to program.log
         # because of execWithRedirect, and to anaconda.log if the script fails.
         if self.logfile:
-            if self.inChroot:
+            if self.inChroot and not self.logfile.startswith("/dev/"):
                 messages = "%s/%s" % (scriptRoot, self.logfile)
             else:
                 messages = self.logfile
@@ -111,15 +111,16 @@ class AnacondaKSScript(Script):
         if rc != 0:
             log.error("Error code %s running the kickstart script at line %s" % (rc, self.lineno))
 
-            try:
-                f = open(messages, "r")
-            except IOError as e:
-                err = None
-            else:
-                err = f.readlines()
-                f.close()
-                for l in err:
-                    log.error("\t%s" % l)
+            if not messages.startswith("/dev/"):
+                try:
+                    f = open(messages, "r")
+                except IOError as e:
+                    err = None
+                else:
+                    err = f.readlines()
+                    f.close()
+                    for l in err:
+                        log.error("\t%s" % l)
 
             if self.errorOnFail:
                 if intf != None:
-- 
1.7.7.6



More information about the anaconda-patches mailing list