facter 1.6.7 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of facter might be problematic. Click here for more details.
- data/CHANGELOG +5 -0
 - data/lib/facter.rb +1 -1
 - data/lib/facter/util/resolution.rb +2 -2
 - data/spec/unit/util/resolution_spec.rb +34 -0
 - metadata +5 -5
 
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/lib/facter.rb
    CHANGED
    
    
| 
         @@ -15,11 +15,11 @@ class Facter::Util::Resolution 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              def self.have_which
         
     | 
| 
       17 
17 
     | 
    
         
             
                if ! defined?(@have_which) or @have_which.nil?
         
     | 
| 
       18 
     | 
    
         
            -
                  if Facter. 
     | 
| 
      
 18 
     | 
    
         
            +
                  if Facter::Util::Config.is_windows?
         
     | 
| 
       19 
19 
     | 
    
         
             
                    @have_which = false
         
     | 
| 
       20 
20 
     | 
    
         
             
                  else
         
     | 
| 
       21 
21 
     | 
    
         
             
                    %x{which which >/dev/null 2>&1}
         
     | 
| 
       22 
     | 
    
         
            -
                    @have_which =  
     | 
| 
      
 22 
     | 
    
         
            +
                    @have_which = $?.success?
         
     | 
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         
             
                @have_which
         
     | 
| 
         @@ -295,4 +295,38 @@ describe Facter::Util::Resolution do 
     | 
|
| 
       295 
295 
     | 
    
         
             
                  Facter::Util::Resolution.exec("echo foo").should == "foo"
         
     | 
| 
       296 
296 
     | 
    
         
             
                end
         
     | 
| 
       297 
297 
     | 
    
         
             
              end
         
     | 
| 
      
 298 
     | 
    
         
            +
             
     | 
| 
      
 299 
     | 
    
         
            +
              describe "have_which" do
         
     | 
| 
      
 300 
     | 
    
         
            +
                before :each do
         
     | 
| 
      
 301 
     | 
    
         
            +
                  Facter::Util::Resolution.instance_variable_set(:@have_which, nil)
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
                  # we do not execute anything in the following test cases itself
         
     | 
| 
      
 304 
     | 
    
         
            +
                  # but we rely on $? to be an instance of Process::Status. So
         
     | 
| 
      
 305 
     | 
    
         
            +
                  # just execute anything here to make sure that $? is not nil
         
     | 
| 
      
 306 
     | 
    
         
            +
                  %x{echo foo}
         
     | 
| 
      
 307 
     | 
    
         
            +
                end
         
     | 
| 
      
 308 
     | 
    
         
            +
             
     | 
| 
      
 309 
     | 
    
         
            +
                it "on windows should always return false" do
         
     | 
| 
      
 310 
     | 
    
         
            +
                  Facter::Util::Config.stubs(:is_windows?).returns(true)
         
     | 
| 
      
 311 
     | 
    
         
            +
                  Facter::Util::Resolution.expects(:`).
         
     | 
| 
      
 312 
     | 
    
         
            +
                    with('which which >/dev/null 2>&1').never
         
     | 
| 
      
 313 
     | 
    
         
            +
                  Facter::Util::Resolution.have_which.should == false
         
     | 
| 
      
 314 
     | 
    
         
            +
                end
         
     | 
| 
      
 315 
     | 
    
         
            +
             
     | 
| 
      
 316 
     | 
    
         
            +
                it "on other platforms than windows should return true if which exists" do
         
     | 
| 
      
 317 
     | 
    
         
            +
                  Facter::Util::Config.stubs(:is_windows?).returns(false)
         
     | 
| 
      
 318 
     | 
    
         
            +
                  Facter::Util::Resolution.expects(:`).
         
     | 
| 
      
 319 
     | 
    
         
            +
                    with('which which >/dev/null 2>&1').returns('')
         
     | 
| 
      
 320 
     | 
    
         
            +
                  Process::Status.any_instance.stubs(:success?).returns true
         
     | 
| 
      
 321 
     | 
    
         
            +
                  Facter::Util::Resolution.have_which.should == true
         
     | 
| 
      
 322 
     | 
    
         
            +
                end
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
                it "on other platforms than windows should return false if which returns non-zero exit code" do
         
     | 
| 
      
 325 
     | 
    
         
            +
                  Facter::Util::Config.stubs(:is_windows?).returns(false)
         
     | 
| 
      
 326 
     | 
    
         
            +
                  Facter::Util::Resolution.expects(:`).
         
     | 
| 
      
 327 
     | 
    
         
            +
                    with('which which >/dev/null 2>&1').returns('')
         
     | 
| 
      
 328 
     | 
    
         
            +
                  Process::Status.any_instance.stubs(:success?).returns false
         
     | 
| 
      
 329 
     | 
    
         
            +
                  Facter::Util::Resolution.have_which.should == false
         
     | 
| 
      
 330 
     | 
    
         
            +
                end
         
     | 
| 
      
 331 
     | 
    
         
            +
              end
         
     | 
| 
       298 
332 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: facter
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 31
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 6
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 1.6. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 8
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 1.6.8
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Puppet Labs
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2012- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2012-04-23 00:00:00 Z
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
            description: You can prove anything with facts!
         
     | 
| 
         @@ -279,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       279 
279 
     | 
    
         
             
            requirements: []
         
     | 
| 
       280 
280 
     | 
    
         | 
| 
       281 
281 
     | 
    
         
             
            rubyforge_project: facter
         
     | 
| 
       282 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 282 
     | 
    
         
            +
            rubygems_version: 1.8.10
         
     | 
| 
       283 
283 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       284 
284 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       285 
285 
     | 
    
         
             
            summary: Facter, a system inventory tool
         
     |