[Pkg-puppet-devel] [facter] 32/46: (Maint) Remove whitespace errors

Stig Sandbeck Mathisen ssm at debian.org
Sun Sep 1 10:47:32 UTC 2013


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit f2a19232ff8b4bbb3334be6be7499c2203110417
Author: Andrew Parker <andy at puppetlabs.com>
Date:   Tue May 28 15:37:00 2013 -0700

    (Maint) Remove whitespace errors
---
 lib/facter/domain.rb     |    9 ++++---
 spec/unit/domain_spec.rb |   58 +++++++++++++++++++++++-----------------------
 2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/lib/facter/domain.rb b/lib/facter/domain.rb
index 0794170..2bfe68b 100644
--- a/lib/facter/domain.rb
+++ b/lib/facter/domain.rb
@@ -23,16 +23,15 @@ Facter.add(:domain) do
     # Get the domain from various sources; the order of these
     # steps is important
 
-    # In some OS 'hostname -f' will change the hostname to '-f' 
-    # We know that Solaris and HP-UX exhibit this behavior 
-    # On good OS, 'hostname -f' will return the FQDN which is preferable 
-    # Due to dangerous behavior of 'hostname -f' on old OS, we will explicitly opt-in 
+    # In some OS 'hostname -f' will change the hostname to '-f'
+    # We know that Solaris and HP-UX exhibit this behavior
+    # On good OS, 'hostname -f' will return the FQDN which is preferable
+    # Due to dangerous behavior of 'hostname -f' on old OS, we will explicitly opt-in
     # 'hostname -f' --hkenney May 9, 2012
     hostname_command = 'hostname'
     can_do_hostname_f = Regexp.union /Linux/i, /FreeBSD/i, /Darwin/i
     hostname_command = 'hostname -f' if Facter.value(:kernel) =~ can_do_hostname_f
 
-       
     if name = Facter::Util::Resolution.exec(hostname_command) \
       and name =~ /.*?\.(.+$)/
 
diff --git a/spec/unit/domain_spec.rb b/spec/unit/domain_spec.rb
index 1135de1..27fb706 100755
--- a/spec/unit/domain_spec.rb
+++ b/spec/unit/domain_spec.rb
@@ -16,30 +16,30 @@ describe "Domain name facts" do
         Facter.fact(:kernel).stubs(:value).returns(nested_hash[:kernel])
         FileTest.stubs(:exists?).with("/etc/resolv.conf").returns(true)
       end
-      
-      let :hostname_command do 
+
+      let :hostname_command do
         nested_hash[:hostname_command]
-      end 
-      
+      end
+
       it "should use the hostname binary" do
         Facter::Util::Resolution.expects(:exec).with(hostname_command).returns "test.example.com"
         Facter.fact(:domain).value.should == "example.com"
       end
-      
+
       it "should fall back to the dnsdomainname binary" do
         Facter::Util::Resolution.expects(:exec).with(hostname_command).returns("myhost")
         Facter::Util::Resolution.expects(:exec).with("dnsdomainname").returns("example.com")
         Facter.fact(:domain).value.should == "example.com"
       end
-      
-      
+
+
       it "should fall back to /etc/resolv.conf" do
         Facter::Util::Resolution.expects(:exec).with(hostname_command).at_least_once.returns("myhost")
         Facter::Util::Resolution.expects(:exec).with("dnsdomainname").at_least_once.returns("")
         File.expects(:open).with('/etc/resolv.conf').at_least_once
         Facter.fact(:domain).value
       end
-      
+
       it "should attempt to resolve facts in a specific order" do
         seq = sequence('domain')
         Facter::Util::Resolution.stubs(:exec).with(hostname_command).in_sequence(seq).at_least_once
@@ -47,16 +47,16 @@ describe "Domain name facts" do
         File.expects(:open).with('/etc/resolv.conf').in_sequence(seq).at_least_once
         Facter.fact(:domain).value
       end
-      
-      describe "Top level domain" do 
+
+      describe "Top level domain" do
         it "should find the domain name" do
           Facter::Util::Resolution.expects(:exec).with(hostname_command).returns "ns01.tld"
           Facter::Util::Resolution.expects(:exec).with("dnsdomainname").never
           File.expects(:exists?).with('/etc/resolv.conf').never
-          Facter.fact(:domain).value.should == "tld" 
-        end  
-      end 
-      
+          Facter.fact(:domain).value.should == "tld"
+        end
+      end
+
       describe "when using /etc/resolv.conf" do
         before do
           Facter::Util::Resolution.stubs(:exec).with(hostname_command)
@@ -64,7 +64,7 @@ describe "Domain name facts" do
           @mock_file = mock()
           File.stubs(:open).with("/etc/resolv.conf").yields(@mock_file)
         end
-        
+
         it "should use the domain field over the search field" do
           lines = [
                    "nameserver 4.2.2.1",
@@ -83,7 +83,7 @@ describe "Domain name facts" do
           @mock_file.expects(:each).multiple_yields(*lines)
           Facter.fact(:domain).value.should == 'example.org'
         end
-        
+
         it "should use the first domain in the search field" do
           lines = [
                    "search example.org example.net",
@@ -91,7 +91,7 @@ describe "Domain name facts" do
           @mock_file.expects(:each).multiple_yields(*lines)
           Facter.fact(:domain).value.should == 'example.org'
         end
-        
+
         # Test permutations of domain and search, where 'domain' can be a value of
         # the search keyword and the domain keyword
         # and also where 'search' can be a value of the search keyword and the
@@ -129,7 +129,7 @@ describe "Domain name facts" do
         end
       end
     end
-  end 
+  end
 
   describe "on Windows" do
     before(:each) do
@@ -173,35 +173,35 @@ describe "Domain name facts" do
     end
   end
 
-  describe "with trailing dots" do 
-    describe "on Windows" do 
+  describe "with trailing dots" do
+    describe "on Windows" do
       before do
         Facter.fact(:kernel).stubs(:value).returns("windows")
         require 'facter/util/registry'
         require 'facter/util/wmi'
       end
- 
+
       [{:registry => 'testdomain.', :wmi => '', :expect => 'testdomain'},
        {:registry => '', :wmi => 'testdomain.', :expect => 'testdomain'},
       ].each do |scenario|
 
-        describe "scenarios" do 
+        describe "scenarios" do
           before(:each) do
             Facter::Util::Registry.stubs(:hklm_read).returns(scenario[:registry])
             nic = stubs 'nic'
             nic.stubs(:DNSDomain).returns(scenario[:wmi])
             Facter::Util::WMI.stubs(:execquery).with("select DNSDomain from Win32_NetworkAdapterConfiguration where IPEnabled = True").returns([nic])
           end
- 
+
           it "should return #{scenario[:expect]}" do
             Facter.fact(:domain).value.should == scenario[:expect]
           end
- 
+
           it "should remove trailing dots"  do
             Facter.fact(:domain).value.should_not =~ /\.$/
           end
-        end 
-      end 
+        end
+      end
     end
 
     describe "on everything else" do
@@ -213,12 +213,12 @@ describe "Domain name facts" do
       [{:hostname => 'host.testdomain.', :dnsdomainname => '', :resolve_domain => '', :resolve_search => '', :expect => 'testdomain'},
        {:hostname => '', :dnsdomainname => 'testdomain.', :resolve_domain => '', :resolve_search => '', :expect => 'testdomain'},
        {:hostname => '', :dnsdomainname => '', :resolve_domain => 'testdomain.', :resolve_search => '', :expect => 'testdomain'},
-       {:hostname => '', :dnsdomainname => '', :resolve_domain => '', :resolve_search => 'testdomain.', :expect => 'testdomain'}, 
+       {:hostname => '', :dnsdomainname => '', :resolve_domain => '', :resolve_search => 'testdomain.', :expect => 'testdomain'},
        {:hostname => '', :dnsdomainname => '', :resolve_domain => '', :resolve_search => '', :expect => nil}
       ].each do |scenario|
 
         describe "scenarios" do
-          before(:each) do 
+          before(:each) do
             Facter::Util::Resolution.stubs(:exec).with("hostname -f").returns(scenario[:hostname])
             Facter::Util::Resolution.stubs(:exec).with("dnsdomainname").returns(scenario[:dnsdomainname])
             @mock_file = mock()
@@ -238,7 +238,7 @@ describe "Domain name facts" do
             Facter.fact(:domain).value.should == scenario[:expect]
           end
         end
-      end      
+      end
     end
   end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list