[Spacewalk-list] Using getVar in a Snippet
William H. ten Bensel
WHTENBEN at up.com
Mon Mar 7 23:16:42 UTC 2016
Uncertain about the getVar commands. However the ks= can be found during
the kickstart in /proc/cmdline as it has the entire command line that was
sent via the anaconda boot options. This would include the ks= and other
variable that can be obtained as well. ie. ip, gateway, netmask,
nameserver and any other misc custom flags (do not have to be valid boot
options) for %post snippets.
So, this information could be written out to a file during the server
kickstart. There may be some better ways to do this, but using
/proc/cmdline has worked for years and continues to do so in Cent/RHEL
7.x.
%post --nochroot
cat /proc/cmdline > /mnt/sysimage/xxxx/xxxx.out
%post
cat /proc/cmdline > /xxxx/xxxxx.out
ksurl=`awk -F"ks=" '{print $1}' /xxxx/xxxxx.out |awk '{print
$1}'`
ks_profile="${ksurlf##*/}"
or if cobbler or Cheetah has issues with the above...
ks_profile=`echo "$ksurl" |rev |cut -d"/" -f1|rev`
- Thanks and good luck
From: Emmett Hogan <ehogan at gmail.com>
To: spacewalk-list at redhat.com
Date: 03/07/2016 04:03 PM
Subject: [Spacewalk-list] Using getVar in a Snippet
Sent by: spacewalk-list-bounces at redhat.com
This email originated from outside of the company. Please use discretion
if opening attachments or clicking on links.
Hi Folks,
I am trying to determine profile used to kickstart a particular machine, I
have tried every version of $getVar that I can think of:
(I started with the one in an example on the
https://fedorahosted.org/cobbler/wiki/KickstartSnippets wiki page)..
#set $p = $getVar('$profile')
That didn't work, so I have tried:
#set $p = $getVar('profile')
#set p = $getVar('profile', 'None')
#set p = $getVar("profile", 'None')
I noticed in the post_install_network_config snippet, they use BOTH:
#set osversion = $getVar("os_version","")
and
#set $numbondingdevs = 0
(Note the use of $ in the 2nd set command...what's the difference?)
Added #raw/#endraw ... that didn't matter.
Help...please?
Thanks in advance.
-Emmett
This email originated from outside of the company. Please use discretion
if opening attachments or clicking on links.
_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list
**
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20160307/1bd3d05f/attachment.htm>
More information about the Spacewalk-list
mailing list