facter 1.7.6 → 2.0.1.rc1

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.

Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/COMMITTERS.md +194 -0
  3. data/CONTRIBUTING.md +63 -235
  4. data/Gemfile +12 -8
  5. data/README.md +1 -2
  6. data/Rakefile +1 -1
  7. data/bin/facter +0 -4
  8. data/ext/build_defaults.yaml +2 -2
  9. data/ext/project_data.yaml +18 -0
  10. data/install.rb +1 -16
  11. data/lib/facter.rb +171 -171
  12. data/lib/facter/application.rb +65 -54
  13. data/lib/facter/core/aggregate.rb +220 -0
  14. data/lib/facter/core/directed_graph.rb +46 -0
  15. data/lib/facter/core/execution.rb +100 -0
  16. data/lib/facter/core/execution/base.rb +73 -0
  17. data/lib/facter/core/execution/posix.rb +50 -0
  18. data/lib/facter/core/execution/windows.rb +57 -0
  19. data/lib/facter/core/logging.rb +169 -0
  20. data/lib/facter/core/resolvable.rb +94 -0
  21. data/lib/facter/core/suitable.rb +117 -0
  22. data/lib/facter/domain.rb +15 -9
  23. data/lib/facter/filesystems.rb +1 -1
  24. data/lib/facter/hardwaremodel.rb +1 -1
  25. data/lib/facter/hostname.rb +3 -3
  26. data/lib/facter/interfaces.rb +6 -1
  27. data/lib/facter/ipaddress.rb +2 -2
  28. data/lib/facter/kernel.rb +1 -1
  29. data/lib/facter/kernelrelease.rb +1 -1
  30. data/lib/facter/ldom.rb +1 -1
  31. data/lib/facter/lsbdistcodename.rb +1 -1
  32. data/lib/facter/lsbdistdescription.rb +1 -1
  33. data/lib/facter/lsbdistid.rb +1 -1
  34. data/lib/facter/lsbdistrelease.rb +1 -1
  35. data/lib/facter/lsbrelease.rb +1 -1
  36. data/lib/facter/macaddress.rb +1 -14
  37. data/lib/facter/macosx.rb +2 -2
  38. data/lib/facter/memory.rb +8 -19
  39. data/lib/facter/operatingsystem.rb +1 -1
  40. data/lib/facter/operatingsystemrelease.rb +34 -1
  41. data/lib/facter/physicalprocessorcount.rb +6 -6
  42. data/lib/facter/processor.rb +11 -10
  43. data/lib/facter/selinux.rb +4 -15
  44. data/lib/facter/ssh.rb +5 -2
  45. data/lib/facter/util/architecture.rb +2 -2
  46. data/lib/facter/util/collection.rb +42 -38
  47. data/lib/facter/util/config.rb +19 -9
  48. data/lib/facter/util/confine.rb +34 -4
  49. data/lib/facter/util/ec2.rb +1 -1
  50. data/lib/facter/util/fact.rb +108 -36
  51. data/lib/facter/util/file_read.rb +7 -6
  52. data/lib/facter/util/formatter.rb +38 -0
  53. data/lib/facter/util/ip.rb +3 -3
  54. data/lib/facter/util/loader.rb +62 -42
  55. data/lib/facter/util/macosx.rb +7 -8
  56. data/lib/facter/util/manufacturer.rb +3 -3
  57. data/lib/facter/util/memory.rb +13 -13
  58. data/lib/facter/util/monkey_patches.rb +0 -31
  59. data/lib/facter/util/netmask.rb +3 -3
  60. data/lib/facter/util/normalization.rb +94 -0
  61. data/lib/facter/util/nothing_loader.rb +3 -6
  62. data/lib/facter/util/parser.rb +3 -5
  63. data/lib/facter/util/plist/generator.rb +1 -1
  64. data/lib/facter/util/processor.rb +15 -15
  65. data/lib/facter/util/resolution.rb +112 -289
  66. data/lib/facter/util/solaris_zones.rb +4 -4
  67. data/lib/facter/util/uptime.rb +8 -3
  68. data/lib/facter/util/values.rb +67 -1
  69. data/lib/facter/util/virtual.rb +10 -10
  70. data/lib/facter/util/xendomains.rb +1 -1
  71. data/lib/facter/version.rb +42 -39
  72. data/lib/facter/virtual.rb +6 -7
  73. data/lib/facter/zfs_version.rb +3 -3
  74. data/lib/facter/zpool_version.rb +3 -3
  75. data/spec/fixtures/unit/netmask/darwin_10_8_5.txt +30 -0
  76. data/spec/unit/application_spec.rb +46 -1
  77. data/spec/unit/core/aggregate_spec.rb +125 -0
  78. data/spec/unit/core/directed_graph_spec.rb +79 -0
  79. data/spec/unit/core/execution/base_spec.rb +119 -0
  80. data/spec/unit/core/execution/posix_spec.rb +86 -0
  81. data/spec/unit/core/execution/windows_spec.rb +106 -0
  82. data/spec/unit/core/execution_spec.rb +37 -0
  83. data/spec/unit/core/logging_spec.rb +104 -0
  84. data/spec/unit/core/resolvable_spec.rb +81 -0
  85. data/spec/unit/core/suitable_spec.rb +96 -0
  86. data/spec/unit/domain_spec.rb +5 -5
  87. data/spec/unit/facter_spec.rb +61 -222
  88. data/spec/unit/filesystems_spec.rb +2 -2
  89. data/spec/unit/hardwareisa_spec.rb +5 -5
  90. data/spec/unit/hardwaremodel_spec.rb +1 -1
  91. data/spec/unit/hostname_spec.rb +4 -4
  92. data/spec/unit/id_spec.rb +3 -3
  93. data/spec/unit/interfaces_spec.rb +10 -0
  94. data/spec/unit/ipaddress6_spec.rb +4 -4
  95. data/spec/unit/ipaddress_spec.rb +1 -1
  96. data/spec/unit/kernel_spec.rb +2 -2
  97. data/spec/unit/kernelmajversion_spec.rb +1 -1
  98. data/spec/unit/kernelrelease_spec.rb +4 -4
  99. data/spec/unit/kernelversion_spec.rb +2 -2
  100. data/spec/unit/ldom_spec.rb +2 -2
  101. data/spec/unit/lsbdistcodename_spec.rb +2 -2
  102. data/spec/unit/lsbdistdescription_spec.rb +2 -2
  103. data/spec/unit/lsbdistid_spec.rb +2 -2
  104. data/spec/unit/lsbdistrelease_spec.rb +2 -2
  105. data/spec/unit/lsbrelease_spec.rb +2 -2
  106. data/spec/unit/manufacturer_spec.rb +1 -1
  107. data/spec/unit/memory_spec.rb +24 -31
  108. data/spec/unit/netmask_spec.rb +9 -0
  109. data/spec/unit/operatingsystem_spec.rb +1 -1
  110. data/spec/unit/operatingsystemrelease_spec.rb +62 -4
  111. data/spec/unit/physicalprocessorcount_spec.rb +10 -10
  112. data/spec/unit/processor_spec.rb +11 -11
  113. data/spec/unit/selinux_spec.rb +2 -8
  114. data/spec/unit/ssh_spec.rb +3 -2
  115. data/spec/unit/uniqueid_spec.rb +3 -3
  116. data/spec/unit/util/collection_spec.rb +37 -35
  117. data/spec/unit/util/config_spec.rb +20 -0
  118. data/spec/unit/util/confine_spec.rb +21 -0
  119. data/spec/unit/util/directory_loader_spec.rb +1 -0
  120. data/spec/unit/util/ec2_spec.rb +6 -6
  121. data/spec/unit/util/fact_spec.rb +92 -90
  122. data/spec/unit/util/ip_spec.rb +2 -2
  123. data/spec/unit/util/loader_spec.rb +127 -186
  124. data/spec/unit/util/macaddress_spec.rb +2 -2
  125. data/spec/unit/util/macosx_spec.rb +8 -8
  126. data/spec/unit/util/manufacturer_spec.rb +3 -3
  127. data/spec/unit/util/normalization_spec.rb +113 -0
  128. data/spec/unit/util/parser_spec.rb +25 -3
  129. data/spec/unit/util/processor_spec.rb +2 -2
  130. data/spec/unit/util/resolution_spec.rb +60 -631
  131. data/spec/unit/util/solaris_zones_spec.rb +5 -5
  132. data/spec/unit/util/uptime_spec.rb +1 -1
  133. data/spec/unit/util/values_spec.rb +131 -0
  134. data/spec/unit/util/virtual_spec.rb +16 -16
  135. data/spec/unit/util/xendomains_spec.rb +2 -2
  136. data/spec/unit/virtual_spec.rb +39 -39
  137. data/spec/unit/zfs_version_spec.rb +11 -11
  138. data/spec/unit/zonename_spec.rb +2 -2
  139. data/spec/unit/zones_spec.rb +1 -1
  140. data/spec/unit/zpool_version_spec.rb +11 -11
  141. metadata +466 -447
  142. data/lib/facter/util/cfpropertylist.rb +0 -6
  143. data/lib/facter/util/cfpropertylist/LICENSE +0 -19
  144. data/lib/facter/util/cfpropertylist/README +0 -44
  145. data/lib/facter/util/cfpropertylist/Rakefile +0 -44
  146. data/lib/facter/util/cfpropertylist/THANKS +0 -7
  147. data/lib/facter/util/cfpropertylist/lib/cfpropertylist.rb +0 -6
  148. data/lib/facter/util/cfpropertylist/lib/rbBinaryCFPropertyList.rb +0 -562
  149. data/lib/facter/util/cfpropertylist/lib/rbCFPlistError.rb +0 -26
  150. data/lib/facter/util/cfpropertylist/lib/rbCFPropertyList.rb +0 -407
  151. data/lib/facter/util/cfpropertylist/lib/rbCFTypes.rb +0 -244
  152. data/lib/facter/util/cfpropertylist/lib/rbLibXMLParser.rb +0 -135
  153. data/lib/facter/util/cfpropertylist/lib/rbNokogiriParser.rb +0 -140
  154. data/lib/facter/util/cfpropertylist/lib/rbREXMLParser.rb +0 -136
  155. data/spec/unit/util/monkey_patches_spec.rb +0 -42
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby -S rspec
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -14,7 +14,7 @@ describe 'Filesystem facts' do
14
14
  before :each do
15
15
  Facter.fact(:kernel).stubs(:value).returns('Linux')
16
16
  fixture_data = my_fixture_read('linux')
17
- Facter::Util::Resolution.expects(:exec) \
17
+ Facter::Core::Execution.expects(:exec) \
18
18
  .with('cat /proc/filesystems 2> /dev/null').returns(fixture_data)
19
19
  Facter.collection.internal_loader.load(:filesystems)
20
20
  end
@@ -6,35 +6,35 @@ require 'facter'
6
6
  describe "Hardwareisa fact" do
7
7
  it "should match uname -p on Linux" do
8
8
  Facter.fact(:kernel).stubs(:value).returns("Linux")
9
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Inky")
9
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Inky")
10
10
 
11
11
  Facter.fact(:hardwareisa).value.should == "Inky"
12
12
  end
13
13
 
14
14
  it "should match uname -p on Darwin" do
15
15
  Facter.fact(:kernel).stubs(:value).returns("Darwin")
16
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Blinky")
16
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Blinky")
17
17
 
18
18
  Facter.fact(:hardwareisa).value.should == "Blinky"
19
19
  end
20
20
 
21
21
  it "should match uname -p on SunOS" do
22
22
  Facter.fact(:kernel).stubs(:value).returns("SunOS")
23
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Pinky")
23
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Pinky")
24
24
 
25
25
  Facter.fact(:hardwareisa).value.should == "Pinky"
26
26
  end
27
27
 
28
28
  it "should match uname -p on FreeBSD" do
29
29
  Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
30
- Facter::Util::Resolution.stubs(:exec).with("uname -p").returns("Clyde")
30
+ Facter::Core::Execution.stubs(:exec).with("uname -p").returns("Clyde")
31
31
 
32
32
  Facter.fact(:hardwareisa).value.should == "Clyde"
33
33
  end
34
34
 
35
35
  it "should match uname -m on HP-UX" do
36
36
  Facter.fact(:kernel).stubs(:value).returns("HP-UX")
37
- Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Pac-Man")
37
+ Facter::Core::Execution.stubs(:exec).with("uname -m").returns("Pac-Man")
38
38
 
39
39
  Facter.fact(:hardwareisa).value.should == "Pac-Man"
40
40
  end
@@ -6,7 +6,7 @@ require 'facter'
6
6
  describe "Hardwaremodel fact" do
7
7
  it "should match uname -m by default" do
8
8
  Facter.fact(:kernel).stubs(:value).returns("Darwin")
9
- Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Inky")
9
+ Facter::Core::Execution.stubs(:exec).with("uname -m").returns("Inky")
10
10
 
11
11
  Facter.fact(:hardwaremodel).value.should == "Inky"
12
12
  end
@@ -11,17 +11,17 @@ describe "Hostname facts" do
11
11
  end
12
12
 
13
13
  it "should use the hostname command" do
14
- Facter::Util::Resolution.expects(:exec).with('hostname').at_least_once
14
+ Facter::Core::Execution.expects(:exec).with('hostname').at_least_once
15
15
  Facter.fact(:hostname).value.should be_nil
16
16
  end
17
17
 
18
18
  it "should use hostname as the fact if unqualified" do
19
- Facter::Util::Resolution.stubs(:exec).with('hostname').returns('host1')
19
+ Facter::Core::Execution.stubs(:exec).with('hostname').returns('host1')
20
20
  Facter.fact(:hostname).value.should == "host1"
21
21
  end
22
22
 
23
23
  it "should truncate the domain name if qualified" do
24
- Facter::Util::Resolution.stubs(:exec).with('hostname').returns('host1.example.com')
24
+ Facter::Core::Execution.stubs(:exec).with('hostname').returns('host1.example.com')
25
25
  Facter.fact(:hostname).value.should == "host1"
26
26
  end
27
27
  end
@@ -33,7 +33,7 @@ describe "Hostname facts" do
33
33
  end
34
34
 
35
35
  it "should use scutil to get the hostname" do
36
- Facter::Util::Resolution.expects(:exec).with('/usr/sbin/scutil --get LocalHostName').returns("host1")
36
+ Facter::Core::Execution.expects(:exec).with('/usr/sbin/scutil --get LocalHostName').returns("host1")
37
37
  Facter.fact(:hostname).value.should == "host1"
38
38
  end
39
39
  end
@@ -12,7 +12,7 @@ describe "id fact" do
12
12
  it "should return the current user" do
13
13
  given_a_configuration_of(:is_windows => k == 'windows')
14
14
  Facter.fact(:kernel).stubs(:value).returns(k)
15
- Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar'
15
+ Facter::Core::Execution.expects(:exec).once.with('whoami').returns 'bar'
16
16
 
17
17
  Facter.fact(:id).value.should == 'bar'
18
18
  end
@@ -21,8 +21,8 @@ describe "id fact" do
21
21
 
22
22
  it "should return the current user on Solaris" do
23
23
  given_a_configuration_of(:is_windows => false)
24
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
25
- Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
24
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('SunOS')
25
+ Facter::Core::Execution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
26
26
 
27
27
  Facter.fact(:id).value.should == 'bar'
28
28
  end
@@ -31,6 +31,16 @@ describe "Per Interface IP facts" do
31
31
  Facter::Util::IP.stubs(:get_interfaces).returns ["Local Area Connection", "Loopback \"Pseudo-Interface\" (#1)"]
32
32
  Facter.fact(:interfaces).value.should == %{Local_Area_Connection,Loopback__Pseudo_Interface____1_}
33
33
  end
34
+
35
+ it "should properly format a mac address" do
36
+ Facter::Util::IP.stubs(:get_interfaces).returns ["net0"]
37
+ Facter::Util::IP.stubs(:get_interface_value).returns "0:12:34:56:78:90"
38
+
39
+ Facter.collection.internal_loader.load(:interfaces)
40
+
41
+ fact = Facter.fact("macaddress_net0".intern)
42
+ fact.value.should eq("00:12:34:56:78:90")
43
+ end
34
44
  end
35
45
 
36
46
  describe "Netmask handling on Linux" do
@@ -15,7 +15,7 @@ describe "The IPv6 address fact" do
15
15
  end
16
16
 
17
17
  it "should return ipaddress6 information for Darwin" do
18
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Darwin')
18
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Darwin')
19
19
  Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
20
20
  Facter::Util::IP.stubs(:exec_ifconfig).with(["-a"]).
21
21
  returns(ifconfig_fixture('darwin_ifconfig_all_with_multiple_interfaces'))
@@ -24,7 +24,7 @@ describe "The IPv6 address fact" do
24
24
  end
25
25
 
26
26
  it "should return ipaddress6 information for Linux" do
27
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux')
27
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
28
28
  Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
29
29
  Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]).
30
30
  returns(ifconfig_fixture('linux_ifconfig_all_with_multiple_interfaces'))
@@ -33,7 +33,7 @@ describe "The IPv6 address fact" do
33
33
  end
34
34
 
35
35
  it "should return ipaddress6 information for Linux with recent net-tools" do
36
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux')
36
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('Linux')
37
37
  Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
38
38
  Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]).
39
39
  returns(ifconfig_fixture('ifconfig_net_tools_1.60.txt'))
@@ -42,7 +42,7 @@ describe "The IPv6 address fact" do
42
42
  end
43
43
 
44
44
  it "should return ipaddress6 information for Solaris" do
45
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
45
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns('SunOS')
46
46
  Facter::Util::IP.stubs(:get_ifconfig).returns("/usr/sbin/ifconfig")
47
47
  Facter::Util::IP.stubs(:exec_ifconfig).with(["-a"]).
48
48
  returns(ifconfig_fixture('sunos_ifconfig_all_with_multiple_interfaces'))
@@ -60,7 +60,7 @@ describe "ipaddress fact" do
60
60
  context "when you have no active network adapter" do
61
61
  it "should return nil if there are no active (or any) network adapters" do
62
62
  Facter::Util::WMI.expects(:execquery).with(Facter::Util::IP::Windows::WMI_IP_INFO_QUERY).returns([])
63
- Facter::Util::Resolution.stubs(:exec)
63
+ Facter::Core::Execution.stubs(:exec)
64
64
 
65
65
  Facter.value(:ipaddress).should == nil
66
66
  end
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby -S rspec
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -16,7 +16,7 @@ describe "Kernel fact" do
16
16
  describe "on everything else" do
17
17
  it "should return the kernel using 'uname -s'" do
18
18
  given_a_configuration_of(:is_windows => false)
19
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns("test_kernel")
19
+ Facter::Core::Execution.stubs(:exec).with('uname -s').returns("test_kernel")
20
20
 
21
21
  Facter.fact(:kernel).value.should == 'test_kernel'
22
22
  end
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby -S rspec
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby -S rspec
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -21,7 +21,7 @@ describe "Kernel release fact" do
21
21
  describe "on AIX" do
22
22
  before do
23
23
  Facter.fact(:kernel).stubs(:value).returns("aix")
24
- Facter::Util::Resolution.stubs(:exec).with('oslevel -s').returns("test_kernel")
24
+ Facter::Core::Execution.stubs(:exec).with('oslevel -s').returns("test_kernel")
25
25
  end
26
26
 
27
27
  it "should return the kernel release" do
@@ -32,7 +32,7 @@ describe "Kernel release fact" do
32
32
  describe "on HP-UX" do
33
33
  before do
34
34
  Facter.fact(:kernel).stubs(:value).returns("hp-ux")
35
- Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("B.11.31")
35
+ Facter::Core::Execution.stubs(:exec).with('uname -r').returns("B.11.31")
36
36
  end
37
37
 
38
38
  it "should remove preceding letters" do
@@ -43,7 +43,7 @@ describe "Kernel release fact" do
43
43
  describe "on everything else" do
44
44
  before do
45
45
  Facter.fact(:kernel).stubs(:value).returns("linux")
46
- Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("test_kernel")
46
+ Facter::Core::Execution.stubs(:exec).with('uname -r').returns("test_kernel")
47
47
  end
48
48
 
49
49
  it "should return the kernel release" do
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby -S rspec
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  require 'spec_helper'
4
4
 
@@ -7,7 +7,7 @@ describe "Kernel version fact" do
7
7
  describe "on Solaris/Sun OS" do
8
8
  before do
9
9
  Facter.fact(:kernel).stubs(:value).returns('sunos')
10
- Facter::Util::Resolution.stubs(:exec).with('uname -v').returns("1.234.5")
10
+ Facter::Core::Execution.stubs(:exec).with('uname -v').returns("1.234.5")
11
11
  end
12
12
 
13
13
  it "should return the kernel version using 'uname -v'" do
@@ -15,7 +15,7 @@ describe "ldom fact" do
15
15
  before :each do
16
16
  # For virtinfo documentation:
17
17
  # http://docs.oracle.com/cd/E23824_01/html/821-1462/virtinfo-1m.html
18
- Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").
18
+ Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").
19
19
  returns(ldom_fixtures('ldom_v1'))
20
20
  Facter.collection.internal_loader.load(:ldom)
21
21
  end
@@ -63,7 +63,7 @@ describe "ldom fact" do
63
63
 
64
64
  describe "when running on non ldom hardware" do
65
65
  before :each do
66
- Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").returns(nil)
66
+ Facter::Core::Execution.stubs(:exec).with("virtinfo -ap").returns(nil)
67
67
  Facter.collection.internal_loader.load(:ldom)
68
68
  end
69
69
 
@@ -11,12 +11,12 @@ describe "lsbdistcodename fact" do
11
11
  end
12
12
 
13
13
  it "should return the codename through lsb_release -c -s 2>/dev/null" do
14
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns 'n/a'
14
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns 'n/a'
15
15
  Facter.fact(:lsbdistcodename).value.should == 'n/a'
16
16
  end
17
17
 
18
18
  it "should return nil if lsb_release is not installed" do
19
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns nil
19
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -c -s 2>/dev/null').returns nil
20
20
  Facter.fact(:lsbdistcodename).value.should be_nil
21
21
  end
22
22
  end
@@ -11,12 +11,12 @@ describe "lsbdistdescription fact" do
11
11
  end
12
12
 
13
13
  it "should return the description through lsb_release -d -s 2>/dev/null" do
14
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
14
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns '"Gentoo Base System release 2.1"'
15
15
  Facter.fact(:lsbdistdescription).value.should == 'Gentoo Base System release 2.1'
16
16
  end
17
17
 
18
18
  it "should return nil if lsb_release is not installed" do
19
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
19
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -d -s 2>/dev/null').returns nil
20
20
  Facter.fact(:lsbdistdescription).value.should be_nil
21
21
  end
22
22
  end
@@ -11,12 +11,12 @@ describe "lsbdistid fact" do
11
11
  end
12
12
 
13
13
  it "should return the id through lsb_release -i -s 2>/dev/null" do
14
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns 'Gentoo'
14
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns 'Gentoo'
15
15
  Facter.fact(:lsbdistid).value.should == 'Gentoo'
16
16
  end
17
17
 
18
18
  it "should return nil if lsb_release is not installed 2>/dev/null" do
19
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns nil
19
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -i -s 2>/dev/null').returns nil
20
20
  Facter.fact(:lsbdistid).value.should be_nil
21
21
  end
22
22
  end
@@ -11,12 +11,12 @@ describe "lsbdistrelease fact" do
11
11
  end
12
12
 
13
13
  it "should return the release through lsb_release -r -s 2>/dev/null" do
14
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns '2.1'
14
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns '2.1'
15
15
  Facter.fact(:lsbdistrelease).value.should == '2.1'
16
16
  end
17
17
 
18
18
  it "should return nil if lsb_release is not installed" do
19
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns nil
19
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -r -s 2>/dev/null').returns nil
20
20
  Facter.fact(:lsbdistrelease).value.should be_nil
21
21
  end
22
22
  end
@@ -11,12 +11,12 @@ describe "lsbrelease fact" do
11
11
  end
12
12
 
13
13
  it "should return the release through lsb_release -v -s 2>/dev/null" do
14
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns 'n/a'
14
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns 'n/a'
15
15
  Facter.fact(:lsbrelease).value.should == 'n/a'
16
16
  end
17
17
 
18
18
  it "should return nil if lsb_release is not installed" do
19
- Facter::Util::Resolution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns nil
19
+ Facter::Core::Execution.stubs(:exec).with('lsb_release -v -s 2>/dev/null').returns nil
20
20
  Facter.fact(:lsbrelease).value.should be_nil
21
21
  end
22
22
  end
@@ -112,4 +112,4 @@ End Of Table
112
112
 
113
113
  end
114
114
 
115
- end
115
+ end
@@ -48,7 +48,7 @@ describe "Memory facts" do
48
48
  before(:each) do
49
49
  Facter.clear
50
50
  Facter.fact(:kernel).stubs(:value).returns("Darwin")
51
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.memsize').returns('8589934592')
51
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.memsize').returns('8589934592')
52
52
  sample_vm_stat = <<VMSTAT
53
53
  Mach Virtual Memory Statistics: (page size of 4096 bytes)
54
54
  Pages free: 28430.
@@ -64,8 +64,8 @@ Pageins: 13862917.
64
64
  Pageouts: 1384383.
65
65
  Object cache: 14 hits of 2619925 lookups (0% hit rate)
66
66
  VMSTAT
67
- Facter::Util::Resolution.stubs(:exec).with('vm_stat').returns(sample_vm_stat)
68
- Facter::Util::Resolution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 1.00M free = 63.00M (encrypted)")
67
+ Facter::Core::Execution.stubs(:exec).with('vm_stat').returns(sample_vm_stat)
68
+ Facter::Core::Execution.stubs(:exec).with('sysctl vm.swapusage').returns("vm.swapusage: total = 64.00M used = 1.00M free = 63.00M (encrypted)")
69
69
 
70
70
  Facter.collection.internal_loader.load(:memory)
71
71
  end
@@ -154,7 +154,7 @@ device maj,min total free
154
154
  /dev/hd6 10, 2 512MB 508MB
155
155
  SWAP
156
156
 
157
- Facter::Util::Resolution.stubs(:exec).with('swap -l 2>/dev/null').returns(swapusage)
157
+ Facter::Core::Execution.stubs(:exec).with('swap -l 2>/dev/null').returns(swapusage)
158
158
 
159
159
  svmon = <<SVMON
160
160
  Unit: KB
@@ -168,7 +168,7 @@ pin 1478228 0 0 953852
168
168
  in use 4448928 0 5499480
169
169
  SVMON
170
170
 
171
- Facter::Util::Resolution.stubs(:exec).with('/usr/bin/svmon -O unit=KB').returns(svmon)
171
+ Facter::Core::Execution.stubs(:exec).with('/usr/bin/svmon -O unit=KB').returns(svmon)
172
172
 
173
173
  Facter.collection.internal_loader.load(:memory)
174
174
  end
@@ -222,16 +222,16 @@ SVMON
222
222
  Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
223
223
 
224
224
  swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
225
- Facter::Util::Resolution.stubs(:exec).with('swapctl -s').returns(swapusage)
225
+ Facter::Core::Execution.stubs(:exec).with('swapctl -s').returns(swapusage)
226
226
 
227
227
  vmstat = <<EOS
228
228
  procs memory page disks traps cpu
229
229
  r b w avm fre flt re pi po fr sr cd0 sd0 int sys cs us sy id
230
230
  0 0 0 11048 181028 39 0 0 0 0 0 0 1 3 90 17 0 0 100
231
231
  EOS
232
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
232
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat)
233
233
 
234
- Facter::Util::Resolution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
234
+ Facter::Core::Execution.stubs(:exec).with("sysctl hw.physmem | cut -d'=' -f2").returns('267321344')
235
235
 
236
236
  Facter.collection.internal_loader.load(:memory)
237
237
  end
@@ -267,14 +267,14 @@ Memory size: 2048 Megabytes
267
267
  System Peripherals (Software Nodes):
268
268
 
269
269
  PRTCONF
270
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/prtconf 2>/dev/null').returns sample_prtconf
270
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/prtconf 2>/dev/null').returns sample_prtconf
271
271
 
272
272
  vmstat_lines = <<VMSTAT
273
273
  kthr memory page disk faults cpu
274
274
  r b w swap free re mf pi po fr de sr s0 s3 -- -- in sy cs us sy id
275
275
  0 0 0 1154552 476224 8 19 0 0 0 0 0 0 0 0 0 460 294 236 1 2 97
276
276
  VMSTAT
277
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat_lines)
277
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat_lines)
278
278
  end
279
279
 
280
280
  after(:each) do
@@ -287,7 +287,7 @@ VMSTAT
287
287
  swapfile dev swaplo blocks free
288
288
  /dev/swap 4294967295,4294967295 16 2097136 2097136
289
289
  SWAP
290
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
290
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
291
291
 
292
292
  Facter.collection.internal_loader.load(:memory)
293
293
  end
@@ -316,7 +316,7 @@ swapfile dev swaplo blocks free
316
316
  /dev/swap 4294967295,4294967295 16 2097136 2097136
317
317
  /dev/swap2 4294967295,4294967295 16 2097136 2097136
318
318
  SWAP
319
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
319
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns sample_swap_line
320
320
  Facter.collection.internal_loader.load(:memory)
321
321
  end
322
322
 
@@ -339,7 +339,7 @@ SWAP
339
339
 
340
340
  describe "when no swap exists" do
341
341
  before(:each) do
342
- Facter::Util::Resolution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns ""
342
+ Facter::Core::Execution.stubs(:exec).with('/usr/sbin/swap -l 2>/dev/null').returns ""
343
343
 
344
344
  Facter.collection.internal_loader.load(:memory)
345
345
  end
@@ -368,19 +368,19 @@ SWAP
368
368
  Facter.fact(:kernel).stubs(:value).returns("dragonfly")
369
369
 
370
370
  swapusage = "total: 148342k bytes allocated = 0k used, 148342k available"
371
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
372
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
373
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
374
- Facter::Util::Resolution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
371
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n hw.pagesize').returns("4096")
372
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_size').returns("128461")
373
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_anon_use').returns("2635")
374
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n vm.swap_cache_use').returns("0")
375
375
 
376
376
  vmstat = <<EOS
377
377
  procs memory page disks faults cpu
378
378
  r b w avm fre flt re pi po fr sr da0 sg1 in sy cs us sy id
379
379
  0 0 0 33152 13940 1902120 2198 53119 11642 6544597 5460994 0 0 6148243 7087927 3484264 0 1 9
380
380
  EOS
381
- Facter::Util::Resolution.stubs(:exec).with('vmstat').returns(vmstat)
381
+ Facter::Core::Execution.stubs(:exec).with('vmstat').returns(vmstat)
382
382
 
383
- Facter::Util::Resolution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
383
+ Facter::Core::Execution.stubs(:exec).with("sysctl -n hw.physmem").returns('248512512')
384
384
 
385
385
  Facter.collection.internal_loader.load(:memory)
386
386
  end
@@ -416,11 +416,11 @@ EOS
416
416
  r b w avm fre flt re pi po fr sr da0 cd0 in sy cs us sy id
417
417
  1 0 0 207600 656640 10 0 0 0 13 0 0 0 51 164 257 0 1 99
418
418
  VM_STAT
419
- Facter::Util::Resolution.stubs(:exec).with('vmstat -H').returns sample_vmstat
419
+ Facter::Core::Execution.stubs(:exec).with('vmstat -H').returns sample_vmstat
420
420
  sample_physmem = <<PHYSMEM
421
421
  1056276480
422
422
  PHYSMEM
423
- Facter::Util::Resolution.stubs(:exec).with('sysctl -n hw.physmem').returns sample_physmem
423
+ Facter::Core::Execution.stubs(:exec).with('sysctl -n hw.physmem').returns sample_physmem
424
424
  end
425
425
 
426
426
  after(:each) do
@@ -432,7 +432,7 @@ PHYSMEM
432
432
  sample_swapinfo = <<SWAP
433
433
  Device 1K-blocks Used Avail Capacity
434
434
  SWAP
435
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
435
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
436
436
 
437
437
  Facter.collection.internal_loader.load(:memory)
438
438
  end
@@ -460,7 +460,7 @@ SWAP
460
460
  Device 1K-blocks Used Avail Capacity
461
461
  /dev/da0p3 2048540 0 1048540 0%
462
462
  SWAP
463
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
463
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
464
464
 
465
465
  Facter.collection.internal_loader.load(:memory)
466
466
  end
@@ -489,7 +489,7 @@ Device 1K-blocks Used Avail Capacity
489
489
  /dev/da0p3 2048540 0 1048540 0%
490
490
  /dev/da0p4 3048540 0 1048540 0%
491
491
  SWAP
492
- Facter::Util::Resolution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
492
+ Facter::Core::Execution.stubs(:exec).with('swapinfo -k').returns sample_swapinfo
493
493
 
494
494
  Facter.collection.internal_loader.load(:memory)
495
495
  end
@@ -534,13 +534,6 @@ SWAP
534
534
  Facter::Util::WMI.stubs(:execquery).returns([computer])
535
535
 
536
536
  Facter.fact(:memorysize_mb).value.should == '3999.55'
537
- Facter.fact(:MemoryTotal).value.should == '3.91 GB'
538
537
  end
539
538
  end
540
-
541
- it "should use the memorysize fact for the memorytotal fact" do
542
- Facter.fact("memorysize").expects(:value).once.returns "16.00 GB"
543
- Facter::Util::Resolution.expects(:exec).never
544
- Facter.fact(:memorytotal).value.should == "16.00 GB"
545
- end
546
539
  end