On 04/08/11 17:14, Urwin, Paul wrote:
Hi,
At the top of my kickstart I have this:
# --- Cobbler Details ---
# name = $name
# distro = $distro
# profile_name = $profile_name
# http_server = $http_server
# hostname = $hostname
# system_name = $getVar("system_name","")
# interfaces = $interfaces.keys()
# ks_meta = "$ks_meta"
However the ks_meta line always just renders as is, the $ks_meta variable name
doesn't get translated into a value:
# --- Cobbler Details ---
# name = myhostname
# distro = rhel5.5
# profile_name = rhel5.5_default
# http_server = 169.111.111.111
# hostname = myhostname.mydomain
# system_name = myhostname
# interfaces = ['vmnic0']
# ks_meta = "$ks_meta"
Is this a known thing? Am I using the wrong variable name?
How can I correctly display the contents of the metadata field?
Hi Paul :)
Thanks!
ks_meta does not exist as a variable when the kickstart is rendered -
the variables set within it are available in their own right (the ksmeta
dict is blended into the system dict)
so with
ksmeta = { 'testvar' : 1, anothervar : 2 }
in your template you can just use
# $testvar
and $othervar
if you want the full kickstart metadata listing for reporting, the only
way I have found to do this is with nasty hacks involving xmlrpclib in a
snippet...
something like this:
#import xmlrpclib
#set $session = $xmlrpclib.ServerProxy('http://localhost/cobbler_api')
#set $data = $session.get_profile($profile_name)['ks_meta']
# variables set in kickstart metadata:
#for $key, $value in $data.items()
# \$$key = $value
#end for
for that to work you also have to whitelist xmlrpclib in
/etc/cobbler/settings
WorksForMe (TM)
Regards,
Stuart