diff options
-rw-r--r-- | lib/facter/ipaddress.rb | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/lib/facter/ipaddress.rb b/lib/facter/ipaddress.rb index a08f26b..08a5dc8 100644 --- a/lib/facter/ipaddress.rb +++ b/lib/facter/ipaddress.rb @@ -19,7 +19,7 @@ Facter.add(:ipaddress) do end Facter.add(:ipaddress) do - confine :kernel => %w{FreeBSD OpenBSD} + confine :kernel => %w{FreeBSD OpenBSD Darwin} setcode do ip = nil output = %x{/sbin/ifconfig} @@ -59,37 +59,6 @@ Facter.add(:ipaddress) do end Facter.add(:ipaddress) do - confine :kernel => %w{darwin} - setcode do - ip = nil - iface = "" - output = %x{/usr/sbin/netstat -rn} - if output =~ /^default\s*\S*\s*\S*\s*\S*\s*\S*\s*(\S*).*/ - iface = $1 - else - warn "Could not find a default route. Using first non-loopback interface" - end - if(iface != "") - output = %x{/sbin/ifconfig #{iface}} - else - output = %x{/sbin/ifconfig} - end - - output.split(/^\S/).each { |str| - if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ - tmp = $1 - unless tmp =~ /^127\./ - ip = tmp - break - end - end - } - - ip - end -end - -Facter.add(:ipaddress) do confine :kernel => %w{AIX} setcode do ip = nil |