"Heijmans S (spir-it)" <Heijmans(a)rechtspraak.nl> wrote:
Hi Scott,
>>If not, I think we should do that. Perhaps leaving behind a '#SNIPPET foo not
found'.
It already leaves this message behind in the kickstart file when the snippet is not found
(cobbler-2.0.5-1.el5);
# Error: no snippet data for foo
Regards,
Stefan
Yes, I saw that in my tests today.
I would still like to be able to check if a snippets file exists.
Alternately, have some way to choose, individually for each snippet, the
behavior of Cobbler when it encounters a missing snippet.
One way or another, if a snippet that is critical to my kickstart
expectations doesn't exist, I would like Cobbler (getks/validateks) to
abort with an error (see recent thread "How to force failure").
If a snippet is not critical, I would like Cobbler to say nothing, so that
there are no extraneous "Error" messages when checking getks output.
-----Oorspronkelijk bericht-----
Van: cobbler-bounces(a)lists.fedorahosted.org
[mailto:cobbler-bounces@lists.fedorahosted.org] Namens Scott Henson
Verzonden: woensdag 2 maart 2011 18:03
Aan: petermity; cobbler(a)lists.fedorahosted.org
Onderwerp: Re: How check for existence of snippet file?
On Wed, 02 Mar 2011 00:12:20 -0800, petermity <6t12-n6js(a)dea.spamcon.org> wrote:
> How can I check for the existence of a snippet file before
> attempting to include it? That is, something like this:
>
> #set $mysnippet = $mysnipdir + '/mysnipfile'
>
> #if file_exists('$mysnippet')
> $SNIPPET('$mysnippet')
> #end if
I believe the snippet code will simply not do anything if the snippet
you include doesn't exist. If not, I think we should do that. Perhaps
leaving behind a '#SNIPPET foo not found'.