> Hennessey Daniel wrote: >> Hey people, >> >> I am trying to use the ksmeta="" construct to pass a list of >> dictionaries through to the kickstart file where I am using a cheetah >> "#for $var in $vars" loop to unravel them. >> >> Is this possible? > > Achieving that result is possible, though as you've entered it, the > variable will just be a string, not a data structure. --ksmeta in the > command line allows for "key=value key=value" ... key/value pairs > seperated by spaces. Those values aren't evaluated to be Python data > structures. > > I have not really used Cheetah for ultra-advanced templating usage, > though it does allow executing arbitrary python code, so in theory, > you could pass in arbitrary strings and work on them in Python, > including evaling them to create real data structures. Whether this > works > as advertised I don't know... though I could definitely use some more > advanced templating examples for the Wiki. > > I'd be inclined to take a simpler approach though, and pass in simple > variables like --ksmeta="eth0=dhcp eth1=dhcp", and then check > for the values of those expressions, possibly in conjunction with "#if" > templating > > #if defined $eth0 # syntax for this is probably wrong :) > > some line containing value for $eth0 > #end > > etc I spent some time working with this today. Cheetah allows you to use #if $variable as a shortcut for "is the variable defined?" This shortcut will not work with Cobbler. If something like that is written in a kickstart template, and the profile with which it is associated doesn't have the variable in its ksmeta, cobbler sync will crash. There's a workaround. Instead of using the shortcut to see if the variable is defined, define it to "none" or something obviously wrong/null in the profile. For example, we have default printer information stored in Cobbler. If we set the profile to have the ksmeta pair of DefaultPrinter=none, our kickstart template can have the section #if $DefaultPrinter != "none" lpoptions -d $DefaultPrinter #end if It works, and is only slightly less elegant than the (not working) #if $DefaultPrinter lpoptions -d $DefaultPrinter #end if I'm running the git sources from 2 days ago, if it matters to anyone. Adam Wolf _______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools