rpms/facter/EL-5 domain-search-order.patch, NONE, 1.1 facter.spec, 1.10, 1.11

David Lutterkort lutter at fedoraproject.org
Fri Nov 7 19:04:12 UTC 2008


Author: lutter

Update of /cvs/pkgs/rpms/facter/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13772/EL-5

Modified Files:
	facter.spec 
Added Files:
	domain-search-order.patch 
Log Message:
Add patch for upstream ticket 1654 (domain name resolution)


domain-search-order.patch:

--- NEW FILE domain-search-order.patch ---
--- facter-1.5.2/lib/facter/domain.rb.domain_order	2008-08-18 19:41:29.000000000 -0500
+++ facter-1.5.2/lib/facter/domain.rb	2008-11-07 09:19:35.514283156 -0600
@@ -1,67 +1,36 @@
 Facter.add(:domain) do
     setcode do
-        # First force the hostname to be checked
+        # Get the domain from various sources; the order of these
+        # steps is important
+
         Facter.value(:hostname)
+        next $domain if defined? $domain and ! $domain.nil?
+
+        domain = Facter::Util::Resolution.exec('dnsdomainname')
+        next domain if domain =~ /.+\..+/
+
+        domain = Facter::Util::Resolution.exec('domainname')
+        next domain if domain =~ /.+\..+/
 
-        # Now check to see if it set the domain
-        if defined? $domain and ! $domain.nil?
-            $domain
-        else
-            nil
-        end
-    end
-end
-# Look for the DNS domain name command first.
-Facter.add(:domain) do
-    setcode do
-        domain = Facter::Util::Resolution.exec('dnsdomainname') or nil
-        # make sure it's a real domain
-        if domain and domain =~ /.+\..+/
-            domain
-        else
-            nil
-        end
-    end
-end
-Facter.add(:domain) do
-    setcode do
-        domain = Facter::Util::Resolution.exec('domainname') or nil
-        # make sure it's a real domain
-        if domain and domain =~ /.+\..+/
-            domain
-        else
-            nil
-        end
-    end
-end
-Facter.add(:domain) do
-    setcode do
-        value = nil
         if FileTest.exists?("/etc/resolv.conf")
+            domain = nil
+            search = nil
             File.open("/etc/resolv.conf") { |file|
-                # is the domain set?
                 file.each { |line|
                     if line =~ /domain\s+(\S+)/
-                        value = $1
-                        break
+                        domain = $1
+                    elsif line =~ /search\s+(\S+)/
+                        search = $1
                     end
                 }
             }
-            ! value and File.open("/etc/resolv.conf") { |file|
-                # is the search path set?
-                file.each { |line|
-                    if line =~ /search\s+(\S+)/
-                        value = $1
-                        break
-                    end
-                }
-            }
-            value
-        else
-            nil
+            next domain if domain
+            next search if search
         end
+        nil
     end
 end
+
 Facter.add(:domain) do
     confine :kernel => :windows
     setcode do
@@ -69,9 +38,9 @@
         domain = ""
         wmi = WIN32OLE.connect("winmgmts://")
         query = "select DNSDomain from Win32_NetworkAdapterConfiguration where IPEnabled = True"
-        wmi.ExecQuery(query).each { |nic| 
+        wmi.ExecQuery(query).each { |nic|
             domain = nic.DNSDomain
-            break 
+            break
         }
         domain
     end


Index: facter.spec
===================================================================
RCS file: /cvs/pkgs/rpms/facter/EL-5/facter.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- facter.spec	10 Sep 2008 06:51:05 -0000	1.10
+++ facter.spec	7 Nov 2008 19:03:42 -0000	1.11
@@ -6,11 +6,13 @@
 Summary: Ruby module for collecting simple facts about a host operating system
 Name: facter
 Version: 1.5.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 URL: http://reductivelabs.com/projects/facter
 Source0: http://reductivelabs.com/downloads/facter/%{name}-%{version}.tgz
+# Committed upstream as de39f6c8; remove with next upstream release
+Patch0: domain-search-order.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 %if %has_ruby_noarch
 BuildArch: noarch
@@ -30,6 +32,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .domain_order
 
 %build
 sed -i -e 's@^#!.*$@#! /usr/bin/ruby@' bin/facter
@@ -64,6 +67,9 @@
 
 
 %changelog
+* Fri Nov  7 2008 David Lutterkort <lutter at redhat.com> - 1.5.2-2
+- Add patch for upstream ticket 1654 (domain name resolution)
+
 * Tue Sep 09 2008 Todd Zullinger <tmz at pobox.com> - 1.5.2-1
 - New version
 - Simplify spec file checking for Fedora and RHEL versions




More information about the fedora-extras-commits mailing list