[Spacewalk-list] Config Management Question

Ian Forde ianforde at gmail.com
Sat Nov 13 06:21:59 UTC 2010


On Fri, 2010-11-12 at 17:45 +0100, Michael Mraka wrote:
> Alex Negvesky wrote:
> % Hello,
> % 
> % I am looking to manage static routes through configuration management.
> % I need a way to grab the first 3 octets of the network for an
> % interface so I can build a route off it. For example "1.2.3.4/24  via
> % (|rhn.system.net_interface.ip_address(eth_device)|.1 "  but obviously
> % with the subnet of the interface (e.g a
> % rhn.system.net_interface.subnet (eth_device) function) instead of the
> % full ip address . Is there a way to do this? If not can I request this
> % feature? It would be extremely useful for configuration management.
> 
> If you want to put it into a shell config which is executed or sourced (e.g
> you can use
> 
> STATIC_GATEWAY=$(echo {|rhn.system.net_interface.ip_address(eth_device)|} | awk -F. '{print $1"."$2"."$3}').245
> 
> which will set STATIC_GATEWAY to X.X.X.245.

Which would work if you're using a /24, but if you're not, you're
looking at some math... why not instead grab it from the node in post
(which should have gotten it from DHCP) via netstat?

	-I




More information about the Spacewalk-list mailing list