[PATCH] Let kickstart users log to device nodes (#835563)

Brian C. Lane bcl at redhat.com
Tue Jun 26 21:45:46 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 the log it isn't a regular file.

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

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index d3648e5..dc3de61 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -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 os.path.isfile(messages):
+                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