puppet/modules/dns/lib/facter/reverse.rb
# define 2 facts for each interface passed in
define 2 facts for each interface passed in
define 2 facts for each interface passed in
def reverse(dev)
  ip = IPAddr.new(Facter.value("network_#{dev}"))
  nm = Puppet::Util::IPCidr.new(Facter.value("network_#{dev}")).mask(Facter.value("netmask_#{dev}"))
  cidr = nm.cidr
  Facter.add("reverse_#{dev}") do
    setcode do ip.reverse.to_s[2..-1] end
  end
  Facter.add("network_cidr_#{dev}") do
    setcode do cidr end
  end
end
def reverse ( dev ) ip = IPAddr . new ( Facter . value ( "network_#{dev}" ) ) nm = Puppet :: Util :: IPCidr . new ( Facter . value ( "network_#{dev}" ) ) . mask ( Facter . value ( "netmask_#{dev}" ) ) cidr = nm . cidr Facter . add ( "reverse_#{dev}" ) do setcode do ip . reverse . to_s [ 2 .. - 1 ] end end Facter . add ( "network_cidr_#{dev}" ) do setcode do cidr end end end
define 2 facts for each interface passed in
define 2 facts for each interface passed in
# network of device # network in cidr notation (uuu.vvv.www.xxx/yy) # set fact for network in reverse vvv.www.uuu.in-addr.arpa # set fact for network in cidr notation # 
dev
<not_specific>