diff options
author | Daniel Pittman <daniel@rimspace.net> | 2011-02-17 14:20:16 -0800 |
---|---|---|
committer | Daniel Pittman <daniel@rimspace.net> | 2011-02-17 14:31:17 -0800 |
commit | 77eb512a85619764a713744108116756969c6c3d (patch) | |
tree | 5381de20994a43c5f4ce03369c00057b2a6a24ef /lib/facter/ipaddress.rb | |
parent | f5bf0f51de6237bd4e63cc22dd4d63bd773952e6 (diff) | |
download | facter-77eb512a85619764a713744108116756969c6c3d.tar.gz facter-77eb512a85619764a713744108116756969c6c3d.tar.xz facter-77eb512a85619764a713744108116756969c6c3d.zip |
(#2270) Remove DWIM code from ipaddress on Darwin.
This mirrors the behaviour of the newer code, and eliminates some DWIM work we
do on a single, specific platform that should, better, be done on a global
platform.
This would be reintroduced globally, applied to all platforms, or otherwise
rebuilt from a consistent base of specified behaviour.
Paired-With: Matt Robinson <matt@puppetlabs.com>
Paired-With: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/facter/ipaddress.rb')
-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 |