[Spacewalk-list] Variables not passing to snippets

Hagberg, Keith Keith.Hagberg at FMR.com
Wed Feb 9 19:21:27 UTC 2011


Even escaping the $ETH did not work.

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

Hagberg, Keith wrote:
% What determines when you need raw mode.

Basically *all* $ signs have to be escaped otherwise python-cheetah (the
templating machine used by cobbler) gets mad and won't render the
snippet.

% 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

----
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
---

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