Re: passing list/dictionary in ksmeta

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

TIA Dan PS this is what I am trying to do; cobbler profile edit --name=RHEL44-ORACLE10G-i386 --ksmeta="nics=[{ 'dev': 'eth0', 'bootproto': 'dhcp'},{ 'dev': 'eth1', 'bootproto': 'dhcp'}]" and the kickstart file has the following snippet in it; #for $nic in $nics
$nic_string = "network"
#for $key, $value in $nic.items()
$nic_string = $nic_string + " --%s %s" % ( $key, $value )
#end for
#end for

************************************************************************

DISCLAIMER

The information contained in this e-mail is confidential and is intended

for the recipient only.

If you have received it in error, please notify us immediately by reply

e-mail and then delete it from your system. Please do not copy it or

use it for any other purposes, or disclose the content of the e-mail

to any other person or store or copy the information in any medium.

The views contained in this e-mail are those of the author and not

necessarily those of Admenta UK Group.

Admenta UK plc is a company incorporated in England and Wales

under company number 3011757 and whose registered office

is at Sapphire Court, Walsgrave Triangle, Coventry CV2 2TX

************************************************************************

------------------------------------------------------------------------

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux