Well, not so much hard as 'impossible', without something similar (or hacking the cobbler source).
the blending happens in kickgen.py/generate_kickstart: # --------- ksmeta = meta["ks_meta"] del meta["ks_meta"] meta.update(ksmeta) # make available at top level # ---------- So unless you find a way to extract that before the kickstart is generated (system add/change triggers, perhaps?) it'll almost certainly still involve xmlrpc calls :) I'm not 100% sure you can add anything to the kickstart output in triggers - although you might be able to generate a per-system snippet in a pre-install (or system-change) snippet, which could include this info into your kickstart as comments. Might be worth a try and would look far less dirty than the hack I posted. [left as an exercise for the reader :) ] Stuart On 08/05/2011 11:24 AM, Urwin, Paul wrote: > Hey Stuart... and you thought you'd escaped! > > Yeah I'm trying to list all meta data variables and their values. > > I like the hack... but not enough to use it ;) > > You'd have thought it wouldn't be hard, but I guess it is! > > Paul > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Stuart Sears > Sent: 04 August 2011 20:52 > To: cobbler mailing list > Subject: Re: $ks_meta? > > 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 > _______________________________________________ > cobbler mailing list > [email protected] > https://fedorahosted.org/mailman/listinfo/cobbler > This communication is for informational purposes only. It is not > intended as an offer or solicitation for the purchase or sale of > any financial instrument or as an official confirmation of any > transaction. All market prices, data and other information are not > warranted as to completeness or accuracy and are subject to change > without notice. Any comments or statements made herein do not > necessarily reflect those of JPMorgan Chase & Co., its subsidiaries > and affiliates. > > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and any > attachments are believed to be free of any virus or other defect > that might affect any computer system into which it is received and > opened, it is the responsibility of the recipient to ensure that it > is virus free and no responsibility is accepted by JPMorgan Chase & > Co., its subsidiaries and affiliates, as applicable, for any loss > or damage arising in any way from its use. If you received this > transmission in error, please immediately contact the sender and > destroy the material in its entirety, whether in electronic or hard > copy format. Thank you. > > Please refer to http://www.jpmorgan.com/pages/disclosures for > disclosures relating to European legal entities. > _______________________________________________ > cobbler mailing list > [email protected] > https://fedorahosted.org/mailman/listinfo/cobbler _______________________________________________ cobbler mailing list [email protected] https://fedorahosted.org/mailman/listinfo/cobbler
