Re: error handling in %post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 9/1/06, Edward F. Brown <ebrown@xxxxxxxx> wrote:
But what if it provided a hook: you still have to
check for errors within %post, but if you could then pass a string to an
anaconda-provided function that would display the message and provide a
shell-prompt window. This could work for text or graphical mode, with any
interpreter, and would not require the explicit tty switch in %post.
Obviously I'm not a python or anaconda developer either, but could this be
hard to implement?  Turn it off (function call ignored), (or conversely,
on), with a kickstart option.

Agreed, depending on your level of comfort with python, something like this should
be pretty easy to patch in.  If you have a chance to pull down the anaconda src.rpm, check
out kickstart.py.  The Script class would probably be where this hook would be implemented
It already grabs the return code, so it should be pretty easy to come up with
a scheme of return codes that would allow %post scripters to utilize this functionality.

Current code...

...[snip]...

        rc = iutil.execWithRedirect(self.interp,
                                    [self.interp,"/tmp/ks-script"],
                                    stdout = messages, stderr = messages,
                                    root = scriptRoot)

        if rc != 0:
            log("WARNING - Error code %s encountered running a kickstart %%pre/%%post script", rc)
...[snip]...

Additional if statements could be built in to allow what you are proposing.  Then just leave the
final else to do the log.  The class also writes the %pre and %post to /tmp/ks-script
(or /mnt/sysimage/tmp/ks-script for chroot), so you could have the opportunity to update it on
the fly and have it re run.

If you'd like to work on this, I'd be happy to help.  I just don't have a test bed to use.  We'd probably
also want to run this by the anaconda-devel list to see this would even be something that could end
up being accepted.

-Jeremy, RHCE

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux