[Spacewalk-list] Variables not passing to snippets

Hagberg, Keith Keith.Hagberg at FMR.com
Fri Feb 4 13:19:43 UTC 2011


What determines when you need raw mode.

If I remove #raw and #end raw the snippet does not get put into the kickstart. When the kickstart is created it still has the snippet  name in it.

I tried to escape the $ETH variable and it still will not replace it.

Here is my snippet

#raw
SPEED=`ethtool $ETH | grep Speed | cut -d' ' -f2`
if [ "$SPEED" == "1000Mb/s" ]; then
   echo NIC running at 1000mb/s
   echo "ETHTOOL_OPTS=\"speed 1000 duplex full autoneg on\"" >> /etc/sysconfig/network-scripts/ifcfg-$ETH
   echo "Resetting "$ETH
   ifup $DEV
elif [ "$SPEED" == "100Mb/s" ]; then
   echo NIC running at 100mb/s
   echo "ETHTOOL_OPTS=\"speed 100 duplex full autoneg off\"" >> /etc/sysconfig/network-scripts/ifcfg-"$ETH"
   echo "Resetting "$ETH
   ifup $ETH
else
   echo could not determine speed
fi
ethtool $ETH
#end raw


-----Original Message-----
From: spacewalk-list-bounces at redhat.com [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Michael Mraka
Sent: Friday, February 04, 2011 6:18 AM
To: spacewalk-list at redhat.com
Subject: Re: [Spacewalk-list] Variables not passing to snippets

Hagberg, Keith wrote:
% Running Spacewalk 1.2 and I have created several snippets for use in
% the post section of the kickstart. I had to add the #raw/#endraw to
% the snippet to get them to properly show up in the kickstart. Doing
% this seems to break the ability to have a variable in the snippet.
% 
% I have a variable ETH=eth0 and am using $ETH in a snippet.
% 
% The $ETH works fine in the kickstart post section not in a snippet.
% 
% When I look at the kickstart itself it is not doing the replacement.

You can either switch raw mode off for a line:

  #raw
  this $dolar sign will not be expanded
  #end raw
  my interface is $ETH0
  #raw
  this $dolar sign either will not be expanded
  #end raw

or do not use raw mode and escape appropriate $ signs:

  this \$dolar sign will not be expanded
  my interface is $ETH0
  this \$dolar sign either will not be expanded

Regards,

--
Michael Mráka
Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list




More information about the Spacewalk-list mailing list