Re:

> 
> On 04/15/2015 10:04 AM, David Lee wrote:
> > The general issue.  In the "%pre" section of the cobbler kickstart file we
> > have a snippet whose purpose is to check a detail of the client machine
> > and, if things are OK, set some variables and proceed as usual.  This is
> > the normal case.
> >
> > But sometimes, particularly with new hardware types, we expect that check
> > to fail; we then want things to stop and print a decent error message.
> >
> > What would be much better is if that snippet itself could (a) produce error
> > messages on the main screen and (b) cleanly halt.
> >
> > Any thoughts?  What have I missed?
> 
> This is not a Cobbler question, as snippet is simply included in the
> automatic installation file (eg kickstart), but that's ok.
> 
> Use --erroronfail
> (http://serverfault.com/questions/446428/how-to-make-kickstart-exit)
> and echo/return 1 in the snippet if your check fails.


Thanks, Alan.

My google searches (prior to sending my email) kept on coming up with that 
page; it looked tantalisingly promising, but frustratingly incomplete.  
Although it's the best thing I found in those searches, it still lacks a worked 
example.  I was also very surprised not to find any authoritative source (RHEL, 
CentOS, etc.) in my searches.

Before my email, I had already tried something like it inside my bash "%pre" 
(now "%pre --erroronfail").  The snippet includes:
    if [ <something went wrong> ]
    then
        echo 'my error details'
        exit 1
    fi

But:

(a) the "echo" text doesn't appear on the main screen;
(b) it heads straight to a reboot, not to a "halted installation" as the 
webpage had claimed.


If I now replace "exit 1" with "return 1", the "return 1" is invalid because 
"return" is not valid in a simple bash script.


Does anyone actually possess a real example of this working?  If they have, 
then I will also willingly add any success to that webpage!

-- David Lee
_______________________________________________
cobbler mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/cobbler

Reply via email to