Yeah, I'll work on the patches tonight. I know Cheetah has some weird inheritance
stuff (again, python), so I'll look at that as a way to get the builtin functions
there, too. I'll also get the advanced SNIPPET thing working tonight as well. Just to
be certain on its functionality:
check if per_system/$system/$file exists and include it if it does.
else check if per_profile/$profile/$file exists and include it if it does.
else check if $file exists and include it if it does.
else if none of those exist just say:
#error no snippet data
I want to make sure that the functionality of the backwards-compatible SNIPPET does not
get broken just because I left something out.
Do you need me to write the replace SNIPPET::x with $SNIPPET('x') functionality,
too?
I'll go ahead and submit a patch that automatically includes the builtins and I'll
submit the SNIPPET builtin. I'm going to wait a bit on some of these other builtins
until I know for sure how I'm going to do them. (I've been using them for the STIG
stuff and have found myself changing them constantly, so hopefully I'll settle soon).
~
Dan
Date: Tue, 29 Jul 2008 16:09:09 -0400
From: mdehaan(a)redhat.com
To: cobbler(a)lists.fedorahosted.org
Subject: Re: Snippet with generalized functions
Dan G wrote:
> OK, hotmail sucks! Please see below. hopefully this time with proper line breaks.
> ________________________________
>
>> From: danpg102(a)hotmail.com
>> To: cobbler(a)lists.fedorahosted.org
>> Subject: Snippet with generalized functions
>> Date: Mon, 28 Jul 2008 18:26:37 -0500
>>
>> Attached is a snippet that makes use of cheetah methods. These are similar to
some of the functionality that the Solaris SST offers. They basically encapsulate many
(usually obscure) sed commands into handy functions.
>>
>
> $set_config_value('/etc/login.defs', 'LOGIN_RETRIES', 3)
>
> is more readable than:
>
> perl -npe 's/^([ \t]*$LOGIN_RETRIES[ \t]+)[\x21-\x7E]*([
\t]*(#.*)?)$/\${1}3\${2}/' -i '/etc/login.defs'
>
> and the perl (sed) command doesn't take into account the possibility that
LOGIN_RETRIES may not already be present in the file. The use of a function makes
kickstart templates more readable and helps avoid errors.
>
> Because of the utility of these functions, I would suggest they be distributed with
cobbler, possibly as 'built-in' methods.
>
> Development note: although I have tested that these functions do not cause any
Cheetah errors, I have not tested the resulting kickstarts in an actual provision. They
may still cause errors on the client side :( .
>
> ~
> Dan
>
>
>> ________________________________
>> With Windows Live for mobile, your contacts travel with you. Connect on the go.
>>
>
> _________________________________________________________________
> With Windows Live for mobile, your contacts travel with you.
>
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_...
> ------------------------------------------------------------------------
>
> _______________________________________________
> cobbler mailing list
> cobbler(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/cobbler
>
Dan,
Neat. Do you have a patch to cobbler to make this automatically
available to all cobbler templates? Something like this might be
interesting.
Basically I think it's just an edit to templar.py to insert the include
at the top of all the templates, and we could ship it in
/etc/cobbler/cheetah.includes or something?
I'm also interested in your generalization of Snippet inclusion with the
"Advanced Snippet" functionality down to Cheetah functions, as that
function is something we could also include in that file.
--Michael
_______________________________________________
cobbler mailing list
cobbler(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler
_________________________________________________________________
With Windows Live for mobile, your contacts travel with you.
http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_...