From: "Brian C. Lane" bcl@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:
On Tue, 2012-06-26 at 11:48 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@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.
Not super-happy with the path check; what if we're looking at /run/sysroot/dev or something?
Why not just check to see if it's a regular file or not? e.g.: if not os.path.isfile(self.logfile):
os.path.isfile() should return true for regular files and symbolic links to regular files; everything else will be false. I think that's the behavior we'd want?
-w
On Tue, Jun 26, 2012 at 04:01:08PM -0400, Will Woods wrote:
On Tue, 2012-06-26 at 11:48 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@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.
Not super-happy with the path check; what if we're looking at /run/sysroot/dev or something?
Why not just check to see if it's a regular file or not? e.g.: if not os.path.isfile(self.logfile):
os.path.isfile() should return true for regular files and symbolic links to regular files; everything else will be false. I think that's the behavior we'd want?
Good idea!
From: "Brian C. Lane" bcl@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:
On 06/26/2012 02:45 PM, Brian C. Lane wrote:
From: "Brian C. Lane"bcl@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
ACK (and pushed for the build)
anaconda-patches@lists.fedorahosted.org