You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
facter/0002-976942-correct-ipaddre...

22 lines
777 B

diff -uNr facter-1.6.18/lib/facter/ipaddress.rb facter-1.6.18/lib/facter/ipaddress.rb
--- lib/facter/ipaddress.rb 2013-03-13 14:17:44.000000000 -0400
+++ lib/facter/ipaddress.rb 2013-06-21 20:44:33.997664732 -0400
@@ -28,10 +28,14 @@
confine :kernel => :linux
setcode do
ip = nil
- if output = Facter::Util::IP.exec_ifconfig(["2>/dev/null"])
+ output = Facter::Util::IP.exec_ifconfig(["2>/dev/null"])
+ if output
regexp = /inet (?:addr:)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/
- if match = regexp.match(output)
- match[1] unless /^127/.match(match[1])
+ output.split("\n").each do |line|
+ match = regexp.match(line)
+ if match
+ break match[1] unless /^127/.match(match[1])
+ end
end
end
end