diff options
author | Ricky Zhou <ricky@fedoraproject.org> | 2011-01-09 18:35:14 -0500 |
---|---|---|
committer | Ricky Zhou <ricky@fedoraproject.org> | 2011-06-13 14:50:03 -0400 |
commit | 5d9fdee2d793d06e5e194b0760a1d566ee191263 (patch) | |
tree | 148f25cb9d12baaa7a234b7c86a2e023db6e75a3 | |
parent | 97927e321d1e24554ad21b92ef4afb1bd64c0167 (diff) | |
download | facter-ticket/1.5.x/5816.tar.gz facter-ticket/1.5.x/5816.tar.xz facter-ticket/1.5.x/5816.zip |
Use iproute2 utility for ipaddress fact.ticket/1.5.x/5816
net-tools is deprecated, and /sbin/ip seems to list interfaces in a more
reasonable order, compared to /sbin/ifconfig's alphabetical order output.
-rw-r--r-- | lib/facter/ipaddress.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/facter/ipaddress.rb b/lib/facter/ipaddress.rb index 5260504..e8b2c38 100644 --- a/lib/facter/ipaddress.rb +++ b/lib/facter/ipaddress.rb @@ -26,10 +26,10 @@ Facter.add(:ipaddress) do confine :kernel => :linux setcode do ip = nil - output = %x{/sbin/ifconfig} + output = %x{/sbin/ip addr show} output.split(/^\S/).each { |str| - if str =~ /inet addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ + if str =~ /inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/ tmp = $1 unless tmp =~ /^127\./ ip = tmp |