You can accomplish the same task by using ksmeta variables, and
writing your template to use them. You could do something like:
$ cobbler system edit --name=foo --ksmeta="power_special_type=two"
Then in your template:
#set $power_special_type = $getVar("power_special_type","one") #
type
'one' is the default
#if $power_special_type=="two"
lanplus
power_wait=4
#else
lanplus
#end if
I acknowledge this is more involved, but it is also infinitely safer
than allowing shell injection (which is really what you were doing
above).
James,
I'm using Cobbler 2.2.3 on RHEL 6.2. I tried the above tip you gave. But, $getVar() is
not working for me. Here's what I did.
1. For a given system, through the web page, I added "ilo_type=ilo3" (without
quotes) in the text field of "Kickstart Metadata". I set the "Power
Management Type" to "ipmilan".
2. When I do 'cobbler system dumpvars' and grep ksmeta I get
ks_meta : ilo_type=ilo3
tree=http://@@distro_master_server@@/cobbler/ks_mirror/rhel6.2-server-x86_64
(It looks like the 'tree' part was inherited from the distro even though I did not
explicitly add it for the 'system' ksmeta)
3. I created the file /etc/cobbler/power/fence_ipmilan.template with following lines:
action=$power_mode
login=$power_user
passwd=$power_pass
ipaddr=$power_address
#set $type_of_ilo = $getVar("ilo_type","ilo2")
#if $type_of_ilo == "ilo3"
lanplus
power_wait=4
#end if
The $getVar() above is always defaulting to "ilo2" and the 2 options that I need
to add for iLO3 (lanplus, power_wait=4) are never getting added. What am I doing wrong?
Thanks
Balaji