Add upstream patch to prevent using the loopback IP (127.0.0.1) instead of the first valid one (BZ#976942)
parent
4b98da968b
commit
77e9ec3403
@ -0,0 +1,21 @@
|
||||
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
|
Loading…
Reference in new issue