facter 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of facter might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 1.6.8
2
+ ===
3
+ b86fe4c (#12831) Add rspec tests to have_which method in Resolution
4
+ 70be957 (#12831) Fix recursion on first kernel fact resolution
5
+
1
6
  1.6.7
2
7
  ===
3
8
  ab9e26c Updating CHANGELOG and lib/facter.rb for Facter 1.6.7rc1
@@ -25,7 +25,7 @@ module Facter
25
25
  include Comparable
26
26
  include Enumerable
27
27
 
28
- FACTERVERSION = '1.6.7'
28
+ FACTERVERSION = '1.6.8'
29
29
  # = Facter
30
30
  # Functions as a hash of 'facts' you might care about about your
31
31
  # system, such as mac address, IP address, Video card, etc.
@@ -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.value(:kernel) == 'windows'
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 = ($? == 0)
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: 1
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 7
10
- version: 1.6.7
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-03-29 00:00:00 Z
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.15
282
+ rubygems_version: 1.8.10
283
283
  signing_key:
284
284
  specification_version: 3
285
285
  summary: Facter, a system inventory tool