Hi everybody,
I want to pass an array to a kickstart file via ksmeta e.g.
cobbler add system [...] --ksmeta="NUMBERS=['no1','no2']" [...]
When I do a dumpvars on the system I get: .. 'mgmt_parameters': {'NUMBERS': '['no1','no2']'}, ..
That seems to be o.k.
The kickstart template looks like this:
#set $NUMBERS = $getVar('$NUMBERS', '') echo "$NUMBERS -- $NUMBERS[0]"
The generated kickstart file is: echo "['no1','no2'] -- ["
So NUMBERS is interpreted as a literal and not an array. I was expecting: echo "['no1','no2'] -- no1"
So my question is how can I get what I expected and make Cheetah interpret the contents of $NUMBERS as an array and not a literal?
Thanks and cheers, Jens
On 04/27/2009 02:37 PM, Ahrens, Jens wrote:
So my question is how can I get what I expected and make Cheetah interpret the contents of $NUMBERS as an array and not a literal?
Thanks and cheers, Jens
you could pass foo=bar1,bar2,bar2 and then do something like this in cheetah:
#set $mylist = $getVar('foo').split(",")
-Jasper
On Mon, 27 Apr 2009 14:37:43 +0200, "Ahrens, Jens" jahrens@uni-mainz.de wrote:
Hi everybody,
I want to pass an array to a kickstart file via ksmeta e.g.
cobbler add system [...] --ksmeta="NUMBERS=['no1','no2']" [...]
When I do a dumpvars on the system I get: .. 'mgmt_parameters': {'NUMBERS': '['no1','no2']'}, ..
That seems to be o.k.
The kickstart template looks like this:
#set $NUMBERS = $getVar('$NUMBERS', '') echo "$NUMBERS -- $NUMBERS[0]"
The generated kickstart file is: echo "['no1','no2'] -- ["
So NUMBERS is interpreted as a literal and not an array. I was expecting: echo "['no1','no2'] -- no1"
So my question is how can I get what I expected and make Cheetah interpret the contents of $NUMBERS as an array and not a literal?
Thanks and cheers, Jens
You'll have to use a little python in your #set to do a join($NUMBERS, ' ').
cobbler@lists.fedorahosted.org