On 09/20/2011 05:15 PM, Idan Shinberg wrote:
> Hello
>
> I'm a heavy user of post Installation Code in the kickstart File.
> Due to multiple profiles requirements , I've decided to devide my post
> installation code into various cobbler SNIPPETS.
> The problems I'm having is that whenever I try to use cheetah(python)
> */#if-else macros/* the snippet doesn't get translated at all.
> ( though If I put syntax errors and do cobbler profile getks it would
> scream about parsing them.
>
> For example:
>
>
> my kickstart is centos.ks.inside , it has the following snippet :
>
> */$SNIPPET('add_mounts')/*
>
>
> /var/lib/cobbler/snippets/add_mounts contains:
>
> */#if profile == 1/*
> */echo "nfs.servers:/mount_1 mount_1 nfs defaults 0 0" >> /etc/fstab/*
> */#end if/*
surely that should be
#if $profile == 1
...
#end if
i.e. in your email you are not using a '$' symbol. Is this the case in
your snippet, also?
In addition, the $profile variable will not exist at the profile level -
systems have this, but profiles do not.
At that point, it'll be $name or $profile_name
the variable that exists at all levels here is $profile_name
Your snippet will not render because it has an 'if' test referencing a
variable that does not exist.
this might work (it does here)
#if $profile_name == 1
...
#end if
system records have a 'profile' property though.
you can see the variable settings like this:
cobbler profile dumpvars --name=your.profile.name | grep -i profile
as an example
for a system:
cobbler system dumpvars --name=rhel55-1.domain.tld | grep -i profile
profile : rhel-5.5-x86_64
profile_name : rhel-5.5-x86_64
but at the profile level...
# cobbler profile dumpvars --name=rhel-5.5-x86_64 | grep -i profile
profile_name : rhel-5.5-x86_64
Regards,
Stuart
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler