raise error to stop install

Philip Rowlands phr at doc.ic.ac.uk
Tue Jul 13 11:22:12 UTC 2004


On Mon, 12 Jul 2004, Jesse Keating wrote:

>So I'm doing some fun stuff in %pre with a python script, and if a
>certain state is matched, I want to raise an error that will abort the
>install.  However it seems that raising an error in %pre doesn't do
>much, or I'm doing it wrong.  Is there a way to raise an error that
>will abort the install (hopefully with a traceback showing my raise)?

The interface between anaconda and %pre is non-python-specific. In other
words, a python error in %pre won't trickle back up into anaconda. This
is all you get in kickstart.py:
(WARNING - mail formatting may have trashed the significant whitespace)

   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)


Doesn't appear that anaconda does any more than log a message and
continue. You could abort the install by never finishing %pre; for
example, switch to vt3 ("chvt 3") to see the script output, and in your
python exception handler print the backtrace, "INSTALL ABORTED", and
then sleep forever.

To take down anaconda, find it and kill the process. To take down
anaconda *and* have the machine reboot, write a very small C program
which calls reboot(2) directly. (This is messy, BTW :))


Cheers,
Phil





More information about the Kickstart-list mailing list