summaryrefslogtreecommitdiffstats
path: root/kickstart.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-11-12 11:08:10 -0500
committerChris Lumens <clumens@redhat.com>2009-11-16 09:52:00 -0500
commit01c22ad6ff057a9474da7fb8ac443fea4d04440a (patch)
tree754ececeb67f4d5849ed80e29b88ae8e97c88ed3 /kickstart.py
parentd5353e22c70a0e36b1fbdb3ee7bbe95cb468606c (diff)
downloadanaconda-01c22ad6ff057a9474da7fb8ac443fea4d04440a.tar.gz
anaconda-01c22ad6ff057a9474da7fb8ac443fea4d04440a.tar.xz
anaconda-01c22ad6ff057a9474da7fb8ac443fea4d04440a.zip
Various improvements to kickstart scriptlet reporting (#510636).
- Don't remove scriptlets when they've been written out to aid in debugging. - Always log stdout/stderr. - On errors, print the messages to anaconda.log as well.
Diffstat (limited to 'kickstart.py')
-rw-r--r--kickstart.py41
1 files changed, 18 insertions, 23 deletions
diff --git a/kickstart.py b/kickstart.py
index 84fd9c9f2..7735439b5 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -69,15 +69,16 @@ class AnacondaKSScript(Script):
os.close(fd)
os.chmod(path, 0700)
- if self.logfile is not None:
+ # Always log stdout/stderr from scripts. Using --logfile just lets you
+ # 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:
messages = "%s/%s" % (scriptRoot, self.logfile)
else:
messages = self.logfile
- elif serial:
- messages = "%s.log" % path
else:
- messages = "/dev/tty3"
+ messages = "%s.log" % path
if intf:
intf.suspend()
@@ -90,11 +91,19 @@ class AnacondaKSScript(Script):
# Always log an error. Only fail if we have a handle on the
# windowing system and the kickstart file included --erroronfail.
if rc != 0:
- log.error("Error code %s encountered running the kickstart script at line %s" % (rc, self.lineno))
+ log.error("Error code %s running the kickstart script at line %s" % (rc, self.lineno))
+
+ try:
+ f = open(messages, "r")
+ err = f.readlines()
+ f.close()
+ for l in err:
+ log.error("\t%s" % l)
+ except:
+ err = None
if self.errorOnFail:
if intf != None:
- err = None
msg = _("There was an error running the kickstart "
"script at line %(lineno)s. You may examine the "
"output in %(msgs)s. This is a fatal error and "
@@ -102,27 +111,13 @@ class AnacondaKSScript(Script):
"OK button to exit the installer.") \
% {'lineno': self.lineno, 'msgs': messages}
- if self.logfile is not None and os.path.isfile(messages):
- try:
- f = open(messages, "r")
- err = f.readlines()
- f.close()
- except:
- pass
-
- if err is None:
- intf.messageWindow(_("Scriptlet Failure"), msg)
+ if err:
+ intf.detailedMessageWindow(_("Scriptlet Failure"), msg, err)
else:
- intf.detailedMessageWindow(_("Scriptlet Failure"), msg,
- err)
+ intf.messageWindow(_("Scriptlet Failure"), msg)
sys.exit(0)
- try:
- os.unlink(path)
- except:
- pass
-
if serial or self.logfile is not None:
os.chmod("%s" % messages, 0600)