Pausing, terminating, and resuming installs

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

 



This is an interesting discussion. I tried a trick recently to PAUSE the
install in the %post section if certain unusual errors occurred (from
here I could decide to continue or cancel). I did this by simply using
the "read" command to wait for <enter> until continuing. Of course, the
problem here ended up being that you are only seeing the output from
your post script and don't actually have anyway to give it input. I
tried a few hacks like using "open" to launch it interactively on
another vt, but that didn't seem to work well either. Has anyone had any
success with such an approach? It would be nice to come up with some
solid error handling for kickstart.

Sean



------------------------------------------------------------------------
Sean P. Kane
spkane@xxxxxxxxxxxxxx
Lead Infrastructure Architect
Genomatica, Inc.
------------------------------------------------------------------------
"When we destroy something man has created we call it vandalism......
 When we destroy something that Gaia has created we call it progress."


-----Original Message-----
From: james.oden@xxxxxxxxxxx [mailto:james.oden@xxxxxxxxxxx] 
Sent: Wednesday, April 02, 2003 14:23
To: kickstart-list@xxxxxxxxxx
Subject: RE: Terminate a CDROM install from %pre



OK, Here is the code from the kickstart.py file that acutally runs a
script (%pre or %post) in anaconda:

    def run(self, chroot, serial):
        scriptRoot = "/"
        if self.inChroot:
            scriptRoot = chroot

        path = scriptRoot + "/tmp/ks-script"

        f = open(path, "w")
        f.write(self.script)
        f.close()
        os.chmod(path, 0700)

        if serial:
            messages = "/tmp/ks-script.log"
        else:
            messages = "/dev/tty3"

        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)

        os.unlink(path)

This code essentialy does the following:

     1) Write the script out to /tmp/ks-script or /tmp/ks-script in the
chrooted enviroment.
     2) Set  output from the script  to go to /dev/tty3 or in case of a
serial install to /tmp/ks-script.log.
     3) Run the written out script.
     4) Print a warning if an error was returned.
     5) Remove the script that was written out.

Note there is no return of the status of the script.  So there is the
first problem.

Now here is the code that actually calls the Script.run() methods for
%pre
scripts:

        log("Running kickstart %%pre script(s)")
        for script in self.preScripts:
            script.run("/", self.serial)
        log("All kickstart %%pre script(s) have been run")

Note again, it does not check the return code and marches merrily along.
Now this bit of code is in KickstartBase.setInstallData(), and I am not
sure where it is called, but probably it would need to return an error
to whatever called it, to get the thing to stop properly.  At anyrate
its easy to see that there was no intention of even caring about return
codes from %pre scripts (or %post scripts for that matter), which I
thinks is the wrong thing to do, or at least there should be an option
to request it to do this, but in most cases if the %pre goes bad, I
don't want the install to continue.  In our case when %pre goes bad
usually shortly there after anaconda goes completley off the rails and
we get a python exception.

cheers...james



_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/kickstart-list





[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