Add upstream patch to prevent using the loopback IP (127.0.0.1) instead of the first valid one (BZ#976942)

epel9
Sam Kottler 12 years ago
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

@ -16,7 +16,7 @@
Name: facter
Version: 1.6.18
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Command and ruby library for gathering system information
Group: System Environment/Base
@ -27,6 +27,7 @@ Source1: http://downloads.puppetlabs.com/%{name}/%{name}-%{version}.tar.g
# https://bugzilla.redhat.com/719611
# https://projects.puppetlabs.com/issues/19989
Patch0: 0001-19989-Filter-virt-what-warnings-from-virtual-fact.patch
Patch1: 0002-976942-correct-ipaddress-non-loopback.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ruby >= 1.8.1
@ -69,6 +70,7 @@ key off the values returned by facts.
%prep
%setup -q
%patch0 -p1
%patch1 -p0
%build
@ -112,6 +114,9 @@ rspec spec
%changelog
* Fri Jun 21 2013 Sam Kottler <skottler@fedoraproject.org> 1.6.18-4
- Apply upstream patch to ensure the first non-127.0.0.1 interface
* Wed Apr 03 2013 Todd Zullinger <tmz@pobox.com> - 1.6.18-3
- Avoid warnings when virt-what produces no output

Loading…
Cancel
Save