facter 1.6.18 → 1.7.0.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 (126) hide show
  1. data/Gemfile +23 -8
  2. data/bin/facter +4 -1
  3. data/ext/build_defaults.yaml +1 -1
  4. data/ext/debian/changelog.erb +4 -22
  5. data/ext/debian/control +2 -2
  6. data/ext/project_data.yaml +1 -1
  7. data/ext/redhat/facter.spec.erb +10 -9
  8. data/install.rb +27 -53
  9. data/lib/facter.rb +23 -5
  10. data/lib/facter/application.rb +21 -0
  11. data/lib/facter/blockdevices.rb +105 -0
  12. data/lib/facter/domain.rb +19 -7
  13. data/lib/facter/filesystems.rb +38 -0
  14. data/lib/facter/hardwaremodel.rb +3 -2
  15. data/lib/facter/ipaddress6.rb +1 -2
  16. data/lib/facter/kernelrelease.rb +10 -2
  17. data/lib/facter/ldom.rb +47 -0
  18. data/lib/facter/macaddress.rb +1 -1
  19. data/lib/facter/manufacturer.rb +7 -1
  20. data/lib/facter/memory.rb +58 -160
  21. data/lib/facter/operatingsystem.rb +17 -2
  22. data/lib/facter/operatingsystemmajrelease.rb +33 -0
  23. data/lib/facter/operatingsystemrelease.rb +88 -37
  24. data/lib/facter/osfamily.rb +6 -2
  25. data/lib/facter/processor.rb +2 -2
  26. data/lib/facter/ps.rb +5 -0
  27. data/lib/facter/ssh.rb +50 -12
  28. data/lib/facter/util/cfpropertylist.rb +6 -0
  29. data/lib/facter/util/cfpropertylist/LICENSE +19 -0
  30. data/lib/facter/util/cfpropertylist/README +44 -0
  31. data/lib/facter/util/cfpropertylist/Rakefile +44 -0
  32. data/lib/facter/util/cfpropertylist/THANKS +7 -0
  33. data/lib/facter/util/cfpropertylist/lib/cfpropertylist.rb +6 -0
  34. data/lib/facter/util/cfpropertylist/lib/rbBinaryCFPropertyList.rb +562 -0
  35. data/lib/facter/util/cfpropertylist/lib/rbCFPlistError.rb +26 -0
  36. data/lib/facter/util/cfpropertylist/lib/rbCFPropertyList.rb +402 -0
  37. data/lib/facter/util/cfpropertylist/lib/rbCFTypes.rb +244 -0
  38. data/lib/facter/util/cfpropertylist/lib/rbLibXMLParser.rb +135 -0
  39. data/lib/facter/util/cfpropertylist/lib/rbNokogiriParser.rb +140 -0
  40. data/lib/facter/util/cfpropertylist/lib/rbREXMLParser.rb +136 -0
  41. data/lib/facter/util/collection.rb +36 -14
  42. data/lib/facter/util/composite_loader.rb +12 -0
  43. data/lib/facter/util/config.rb +36 -0
  44. data/lib/facter/util/confine.rb +1 -6
  45. data/lib/facter/util/directory_loader.rb +83 -0
  46. data/lib/facter/util/fact.rb +49 -42
  47. data/lib/facter/util/file_read.rb +32 -0
  48. data/lib/facter/util/ip.rb +2 -9
  49. data/lib/facter/util/loader.rb +16 -2
  50. data/lib/facter/util/macosx.rb +15 -2
  51. data/lib/facter/util/memory.rb +154 -27
  52. data/lib/facter/util/nothing_loader.rb +15 -0
  53. data/lib/facter/util/parser.rb +141 -0
  54. data/lib/facter/util/processor.rb +27 -35
  55. data/lib/facter/util/resolution.rb +97 -26
  56. data/lib/facter/util/solaris_zones.rb +153 -0
  57. data/lib/facter/util/virtual.rb +32 -3
  58. data/lib/facter/version.rb +72 -2
  59. data/lib/facter/virtual.rb +56 -3
  60. data/lib/facter/zfs_version.rb +10 -0
  61. data/lib/facter/zonename.rb +6 -0
  62. data/lib/facter/zones.rb +17 -0
  63. data/lib/facter/zpool_version.rb +10 -0
  64. data/spec/fixtures/ifconfig/ifconfig_net_tools_1.60.txt +19 -0
  65. data/spec/fixtures/ifconfig/ifconfig_ubuntu_1204.txt +16 -0
  66. data/spec/fixtures/ldom/ldom_v1 +6 -0
  67. data/spec/fixtures/unit/filesystems/linux +28 -0
  68. data/spec/fixtures/unit/util/manufacturer/intel_linux_dmidecode +549 -0
  69. data/spec/fixtures/unit/virtual/sysfs_dmi_entries_raw.txt +0 -0
  70. data/spec/fixtures/unit/zfs_version/freebsd_8.2 +14 -0
  71. data/spec/fixtures/unit/zfs_version/freebsd_9.0 +13 -0
  72. data/spec/fixtures/unit/zfs_version/linux-fuse_0.6.9 +14 -0
  73. data/spec/fixtures/unit/zfs_version/solaris_10 +10 -0
  74. data/spec/fixtures/unit/zfs_version/solaris_11 +12 -0
  75. data/spec/fixtures/unit/zpool_version/freebsd_8.2 +26 -0
  76. data/spec/fixtures/unit/zpool_version/freebsd_9.0 +38 -0
  77. data/spec/fixtures/unit/zpool_version/linux-fuse_0.6.9 +35 -0
  78. data/spec/fixtures/unit/zpool_version/solaris_10 +31 -0
  79. data/spec/fixtures/unit/zpool_version/solaris_11 +43 -0
  80. data/spec/integration/facter_spec.rb +12 -0
  81. data/spec/spec_helper.rb +9 -0
  82. data/spec/unit/architecture_spec.rb +1 -1
  83. data/spec/unit/blockdevices_spec.rb +109 -0
  84. data/spec/unit/domain_spec.rb +189 -81
  85. data/spec/unit/ec2_spec.rb +15 -8
  86. data/spec/unit/filesystems_spec.rb +50 -0
  87. data/spec/unit/hardwaremodel_spec.rb +8 -1
  88. data/spec/unit/id_spec.rb +6 -5
  89. data/spec/unit/ipaddress6_spec.rb +14 -2
  90. data/spec/unit/ipaddress_spec.rb +1 -1
  91. data/spec/unit/kernel_spec.rb +24 -0
  92. data/spec/unit/kernelmajversion_spec.rb +17 -0
  93. data/spec/unit/kernelrelease_spec.rb +53 -0
  94. data/spec/unit/kernelversion_spec.rb +32 -0
  95. data/spec/unit/ldom_spec.rb +74 -0
  96. data/spec/unit/macaddress_spec.rb +3 -1
  97. data/spec/unit/manufacturer_spec.rb +115 -0
  98. data/spec/unit/memory_spec.rb +442 -75
  99. data/spec/unit/operatingsystem_spec.rb +16 -2
  100. data/spec/unit/operatingsystemmajrelease_spec.rb +16 -0
  101. data/spec/unit/operatingsystemrelease_spec.rb +110 -1
  102. data/spec/unit/processor_spec.rb +22 -7
  103. data/spec/unit/ps_spec.rb +42 -0
  104. data/spec/unit/ssh_spec.rb +76 -0
  105. data/spec/unit/util/collection_spec.rb +94 -118
  106. data/spec/unit/util/config_spec.rb +36 -5
  107. data/spec/unit/util/confine_spec.rb +31 -43
  108. data/spec/unit/util/directory_loader_spec.rb +87 -0
  109. data/spec/unit/util/fact_spec.rb +37 -25
  110. data/spec/unit/util/file_read_spec.rb +29 -0
  111. data/spec/unit/util/ip_spec.rb +4 -2
  112. data/spec/unit/util/loader_spec.rb +102 -45
  113. data/spec/unit/util/macosx_spec.rb +40 -9
  114. data/spec/unit/util/manufacturer_spec.rb +12 -1
  115. data/spec/unit/util/parser_spec.rb +135 -0
  116. data/spec/unit/util/resolution_spec.rb +136 -4
  117. data/spec/unit/util/solaris_zones_spec.rb +127 -0
  118. data/spec/unit/util/virtual_spec.rb +54 -0
  119. data/spec/unit/version_spec.rb +42 -0
  120. data/spec/unit/virtual_spec.rb +102 -27
  121. data/spec/unit/zfs_version_spec.rb +76 -0
  122. data/spec/unit/zonename_spec.rb +14 -0
  123. data/spec/unit/zones_spec.rb +55 -0
  124. data/spec/unit/zpool_version_spec.rb +76 -0
  125. metadata +113 -11
  126. data/lib/facter/arp.rb +0 -28
@@ -28,7 +28,8 @@ describe "ec2 facts" do
28
28
  with("#{api_prefix}/2008-02-01/meta-data/foo").
29
29
  at_least_once.returns(StringIO.new("bar"))
30
30
 
31
- Facter.collection.loader.load(:ec2)
31
+ Facter.collection.internal_loader.load(:ec2)
32
+
32
33
  Facter.fact(:ec2_foo).value.should == "bar"
33
34
  end
34
35
 
@@ -41,7 +42,8 @@ describe "ec2 facts" do
41
42
  with("#{api_prefix}/2008-02-01/meta-data/foo").
42
43
  at_least_once.returns(StringIO.new("bar\nbaz"))
43
44
 
44
- Facter.collection.loader.load(:ec2)
45
+ Facter.collection.internal_loader.load(:ec2)
46
+
45
47
  Facter.fact(:ec2_foo).value.should == "bar,baz"
46
48
  end
47
49
 
@@ -58,7 +60,8 @@ describe "ec2 facts" do
58
60
  with("#{api_prefix}/2008-02-01/meta-data/foo/bar").
59
61
  at_least_once.returns(StringIO.new("baz"))
60
62
 
61
- Facter.collection.loader.load(:ec2)
63
+ Facter.collection.internal_loader.load(:ec2)
64
+
62
65
  Facter.fact(:ec2_foo_bar).value.should == "baz"
63
66
  end
64
67
 
@@ -72,7 +75,7 @@ describe "ec2 facts" do
72
75
  with("#{api_prefix}/latest/user-data/").
73
76
  returns("test")
74
77
 
75
- Facter.collection.loader.load(:ec2)
78
+ Facter.collection.internal_loader.load(:ec2)
76
79
  Facter.fact(:ec2_userdata).value.should == ["test"]
77
80
  end
78
81
  end
@@ -99,7 +102,7 @@ describe "ec2 facts" do
99
102
  returns("test")
100
103
 
101
104
  # Force a fact load
102
- Facter.collection.loader.load(:ec2)
105
+ Facter.collection.internal_loader.load(:ec2)
103
106
 
104
107
  Facter.fact(:ec2_userdata).value.should == ["test"]
105
108
  end
@@ -127,7 +130,7 @@ describe "ec2 facts" do
127
130
  returns("test")
128
131
 
129
132
  # Force a fact load
130
- Facter.collection.loader.load(:ec2)
133
+ Facter.collection.internal_loader.load(:ec2)
131
134
 
132
135
  Facter.fact(:ec2_userdata).value.should == ["test"]
133
136
  end
@@ -145,7 +148,7 @@ describe "ec2 facts" do
145
148
  raises(RuntimeError, 'host unreachable')
146
149
 
147
150
  # Force a fact load
148
- Facter.collection.loader.load(:ec2)
151
+ Facter.collection.internal_loader.load(:ec2)
149
152
 
150
153
  Facter.fact(:ec2_userdata).value.should be_nil
151
154
  end
@@ -153,6 +156,10 @@ describe "ec2 facts" do
153
156
  end
154
157
 
155
158
  describe "when api connect test fails" do
159
+ before :each do
160
+ Facter.stubs(:warnonce)
161
+ end
162
+
156
163
  it "should not populate ec2_userdata" do
157
164
  # Emulate ec2 for now as it matters little to this test
158
165
  Facter::Util::EC2.stubs(:has_euca_mac?).returns(true)
@@ -166,7 +173,7 @@ describe "ec2 facts" do
166
173
  with("#{api_prefix}/2008-02-01/user-data/").never
167
174
 
168
175
  # Force a fact load
169
- Facter.collection.loader.load(:ec2)
176
+ Facter.collection.internal_loader.load(:ec2)
170
177
 
171
178
  Facter.fact(:ec2_userdata).should == nil
172
179
  end
@@ -0,0 +1,50 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Filesystem facts' do
6
+ describe 'on non-Linux OS' do
7
+ it 'should not exist' do
8
+ Facter.fact(:kernel).stubs(:value).returns('SunOS')
9
+ Facter.fact(:filesystems).value.should == nil
10
+ end
11
+ end
12
+
13
+ describe 'on Linux' do
14
+ before :each do
15
+ Facter.fact(:kernel).stubs(:value).returns('Linux')
16
+ fixture_data = my_fixture_read('linux')
17
+ Facter::Util::Resolution.expects(:exec) \
18
+ .with('cat /proc/filesystems 2> /dev/null').returns(fixture_data)
19
+ Facter.collection.internal_loader.load(:filesystems)
20
+ end
21
+
22
+ after :each do
23
+ Facter.clear
24
+ end
25
+
26
+ it 'should exist' do
27
+ Facter.fact(:filesystems).value.should_not == nil
28
+ end
29
+
30
+ it 'should detect the correct number of filesystems' do
31
+ Facter.fact(:filesystems).value.split(',').length.should == 6
32
+ end
33
+
34
+ # Check that lines from /proc/filesystems that start with 'nodev' are
35
+ # skipped
36
+ it 'should not detect sysfs' do
37
+ Facter.fact(:filesystems).value.split(',').should_not include('sysfs')
38
+ end
39
+
40
+ # Check that all other lines are counted as valid filesystems
41
+ it 'should detect ext4' do
42
+ Facter.fact(:filesystems).value.split(',').should include('ext4')
43
+ end
44
+
45
+ # fuseblk is never included in the filesystem list
46
+ it 'should not detect fuseblk' do
47
+ Facter.fact(:filesystems).value.split(',').should_not include('fuseblk')
48
+ end
49
+ end
50
+ end
@@ -25,10 +25,17 @@ describe "Hardwaremodel fact" do
25
25
  end
26
26
 
27
27
  it "should detect x64" do
28
- cpu = mock('cpu', :Architecture => 9)
28
+ cpu = mock('cpu', :Architecture => 9, :AddressWidth => 64)
29
29
  Facter::Util::WMI.expects(:execquery).returns([cpu])
30
30
 
31
31
  Facter.fact(:hardwaremodel).value.should == "x64"
32
32
  end
33
+
34
+ it "(#16948) reports i686 when a 32 bit OS is running on a 64 bit CPU" do
35
+ cpu = mock('cpu', :Architecture => 9, :AddressWidth => 32, :Level => 6)
36
+ Facter::Util::WMI.expects(:execquery).returns([cpu])
37
+
38
+ Facter.fact(:hardwaremodel).value.should == "i686"
39
+ end
33
40
  end
34
41
  end
@@ -3,14 +3,15 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe "id fact" do
6
+ include FacterSpec::ConfigHelper
6
7
 
7
8
  kernel = [ 'Linux', 'Darwin', 'windows', 'FreeBSD', 'OpenBSD', 'NetBSD', 'AIX', 'HP-UX' ]
8
9
 
9
10
  kernel.each do |k|
10
11
  describe "with kernel reported as #{k}" do
11
12
  it "should return the current user" do
13
+ given_a_configuration_of(:is_windows => k == 'windows')
12
14
  Facter.fact(:kernel).stubs(:value).returns(k)
13
- Facter::Util::Config.stubs(:is_windows?).returns(k == 'windows')
14
15
  Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar'
15
16
 
16
17
  Facter.fact(:id).value.should == 'bar'
@@ -19,10 +20,10 @@ describe "id fact" do
19
20
  end
20
21
 
21
22
  it "should return the current user on Solaris" do
22
- Facter::Util::Config.stubs(:is_windows?).returns(false)
23
- Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
24
- Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar'
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'
25
26
 
26
- Facter.fact(:id).value.should == 'bar'
27
+ Facter.fact(:id).value.should == 'bar'
27
28
  end
28
29
  end
@@ -11,9 +11,12 @@ def netsh_fixture(filename)
11
11
  File.read(fixtures('netsh', filename))
12
12
  end
13
13
 
14
+
14
15
  describe "IPv6 address fact" do
16
+ include FacterSpec::ConfigHelper
17
+
15
18
  before do
16
- Facter::Util::Config.stubs(:is_windows?).returns(false)
19
+ given_a_configuration_of(:is_windows => false)
17
20
  end
18
21
 
19
22
  it "should return ipaddress6 information for Darwin" do
@@ -34,6 +37,15 @@ describe "IPv6 address fact" do
34
37
  Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201"
35
38
  end
36
39
 
40
+ it "should return ipaddress6 information for Linux with recent net-tools" do
41
+ Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('Linux')
42
+ Facter::Util::IP.stubs(:get_ifconfig).returns("/sbin/ifconfig")
43
+ Facter::Util::IP.stubs(:exec_ifconfig).with(["2>/dev/null"]).
44
+ returns(ifconfig_fixture('ifconfig_net_tools_1.60.txt'))
45
+
46
+ Facter.value(:ipaddress6).should == "2610:10:20:209:212:3fff:febe:2201"
47
+ end
48
+
37
49
  it "should return ipaddress6 information for Solaris" do
38
50
  Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS')
39
51
  Facter::Util::IP.stubs(:get_ifconfig).returns("/usr/sbin/ifconfig")
@@ -45,7 +57,7 @@ describe "IPv6 address fact" do
45
57
 
46
58
  it "should return ipaddress6 information for Windows" do
47
59
  ENV.stubs(:[]).with('SYSTEMROOT').returns('d:/windows')
48
- Facter::Util::Config.stubs(:is_windows?).returns(true)
60
+ given_a_configuration_of(:is_windows => true)
49
61
 
50
62
  fixture = netsh_fixture('windows_netsh_addresses_with_multiple_interfaces')
51
63
  Facter::Util::Resolution.stubs(:exec).with('d:/windows/system32/netsh.exe interface ipv6 show address level=verbose').
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  describe "The ipaddress fact" do
18
18
  subject do
19
- Facter.collection.loader.load(:ipaddress)
19
+ Facter.collection.internal_loader.load(:ipaddress)
20
20
  Facter.fact(:ipaddress)
21
21
  end
22
22
  context "on Linux" do
@@ -0,0 +1,24 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "Kernel fact" do
6
+ include FacterSpec::ConfigHelper
7
+
8
+ describe "on Windows" do
9
+ it "should return the kernel as 'windows'" do
10
+ given_a_configuration_of(:is_windows => true, :data_dir => "data_dir")
11
+
12
+ Facter.fact(:kernel).value.should == "windows"
13
+ end
14
+ end
15
+
16
+ describe "on everything else" do
17
+ it "should return the kernel using 'uname -s'" do
18
+ given_a_configuration_of(:is_windows => false)
19
+ Facter::Util::Resolution.stubs(:exec).with('uname -s').returns("test_kernel")
20
+
21
+ Facter.fact(:kernel).value.should == 'test_kernel'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "Kernel major version fact" do
6
+
7
+ before do
8
+ Facter.fact(:kernelversion).stubs(:value).returns("12.34.56")
9
+ end
10
+
11
+ it "should return the kernel major release using the kernel release" do
12
+ Facter.fact(:kernelmajversion).value.should == "12.34"
13
+ end
14
+ end
15
+
16
+
17
+
@@ -0,0 +1,53 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "Kernel release fact" do
6
+
7
+ describe "on Windows" do
8
+ before do
9
+ Facter.fact(:kernel).stubs(:value).returns("windows")
10
+ require 'facter/util/wmi'
11
+ version = stubs 'version'
12
+ version.stubs(:Version).returns("test_kernel")
13
+ Facter::Util::WMI.stubs(:execquery).with("SELECT Version from Win32_OperatingSystem").returns([version])
14
+ end
15
+
16
+ it "should return the kernel release" do
17
+ Facter.fact(:kernelrelease).value.should == "test_kernel"
18
+ end
19
+ end
20
+
21
+ describe "on AIX" do
22
+ before do
23
+ Facter.fact(:kernel).stubs(:value).returns("aix")
24
+ Facter::Util::Resolution.stubs(:exec).with('oslevel -s').returns("test_kernel")
25
+ end
26
+
27
+ it "should return the kernel release" do
28
+ Facter.fact(:kernelrelease).value.should == "test_kernel"
29
+ end
30
+ end
31
+
32
+ describe "on HP-UX" do
33
+ before do
34
+ Facter.fact(:kernel).stubs(:value).returns("hp-ux")
35
+ Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("B.11.31")
36
+ end
37
+
38
+ it "should remove preceding letters" do
39
+ Facter.fact(:kernelrelease).value.should == "11.31"
40
+ end
41
+ end
42
+
43
+ describe "on everything else" do
44
+ before do
45
+ Facter.fact(:kernel).stubs(:value).returns("linux")
46
+ Facter::Util::Resolution.stubs(:exec).with('uname -r').returns("test_kernel")
47
+ end
48
+
49
+ it "should return the kernel release" do
50
+ Facter.fact(:kernelrelease).value.should == "test_kernel"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,32 @@
1
+ #! /usr/bin/env ruby -S rspec
2
+
3
+ require 'spec_helper'
4
+
5
+ describe "Kernel version fact" do
6
+
7
+ describe "on Solaris/Sun OS" do
8
+ before do
9
+ Facter.fact(:kernel).stubs(:value).returns('sunos')
10
+ Facter::Util::Resolution.stubs(:exec).with('uname -v').returns("1.234.5")
11
+ end
12
+
13
+ it "should return the kernel version using 'uname -v'" do
14
+ Facter.fact(:kernelversion).value.should == "1.234.5"
15
+ end
16
+ end
17
+
18
+ describe "on everything else" do
19
+ before do
20
+ Facter.fact(:kernel).stubs(:value).returns('linux')
21
+ Facter.fact(:kernelrelease).stubs(:value).returns('1.23.4-56')
22
+ end
23
+
24
+ it "should return the kernel version using kernel release" do
25
+ Facter.fact(:kernelversion).value.should == "1.23.4"
26
+ end
27
+ end
28
+ end
29
+
30
+
31
+
32
+
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spec_helper'
4
+
5
+ def ldom_fixtures(filename)
6
+ File.read(fixtures('ldom', filename))
7
+ end
8
+
9
+ describe "ldom fact" do
10
+ before do
11
+ Facter.fact(:kernel).stubs(:value).returns("SunOS")
12
+ end
13
+
14
+ describe "when running on ldom hardware" do
15
+ before :each do
16
+ # For virtinfo documentation:
17
+ # http://docs.oracle.com/cd/E23824_01/html/821-1462/virtinfo-1m.html
18
+ Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").
19
+ returns(ldom_fixtures('ldom_v1'))
20
+ Facter.collection.internal_loader.load(:ldom)
21
+ end
22
+
23
+ it "should return correct impl on version 1.0" do
24
+ Facter.fact(:ldom_domainrole_impl).value.should == "LDoms"
25
+ end
26
+
27
+ it "should return correct control on version 1.0" do
28
+ Facter.fact(:ldom_domainrole_control).value.should == "false"
29
+ end
30
+
31
+ it "should return correct io on version 1.0" do
32
+ Facter.fact(:ldom_domainrole_io).value.should == "true"
33
+ end
34
+
35
+ it "should return correct service on version 1.0" do
36
+ Facter.fact(:ldom_domainrole_service).value.should == "true"
37
+ end
38
+
39
+ it "should return correct root on version 1.0" do
40
+ Facter.fact(:ldom_domainrole_root).value.should == "true"
41
+ end
42
+
43
+ it "should return correct domain name on version 1.0" do
44
+ Facter.fact(:ldom_domainname).value.should == "primary"
45
+ end
46
+
47
+ it "should return correct uuid on version 1.0" do
48
+ Facter.fact(:ldom_domainuuid).value.should == "8e0d6ec5-cd55-e57f-ae9f-b4cc050999a4"
49
+ end
50
+
51
+ it "should return correct ldomcontrol on version 1.0" do
52
+ Facter.fact(:ldom_domaincontrol).value.should == "san-t2k-6"
53
+ end
54
+
55
+ it "should return correct serial on version 1.0" do
56
+ Facter.fact(:ldom_domainchassis).value.should == "0704RB0280"
57
+ end
58
+
59
+ it "should return correct virtual on version 1.0" do
60
+ Facter.fact(:virtual).value.should == "LDoms"
61
+ end
62
+ end
63
+
64
+ describe "when running on non ldom hardware" do
65
+ before :each do
66
+ Facter::Util::Resolution.stubs(:exec).with("virtinfo -ap").returns(nil)
67
+ Facter.collection.internal_loader.load(:ldom)
68
+ end
69
+
70
+ it "should return correct virtual" do
71
+ Facter.fact(:ldom_domainrole_impl).should == nil
72
+ end
73
+ end
74
+ end
@@ -13,8 +13,10 @@ def netsh_fixture(filename)
13
13
  end
14
14
 
15
15
  describe "macaddress fact" do
16
+ include FacterSpec::ConfigHelper
17
+
16
18
  before do
17
- Facter::Util::Config.stubs(:is_windows?).returns(false)
19
+ given_a_configuration_of(:is_windows => false)
18
20
  end
19
21
 
20
22
  describe "when run on Linux" do