error handling in %post

Jeremy Lyon jerlyon at gmail.com
Sat Sep 2 17:27:25 UTC 2006


On 9/1/06, Edward F. Brown <ebrown at lanl.gov> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kickstart-list/attachments/20060902/e0fb325f/attachment.htm>


More information about the Kickstart-list mailing list