facter 2.2.0-x86-mingw32 → 2.3.0-x86-mingw32

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 (50) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.md +4 -0
  3. data/Gemfile +2 -1
  4. data/LICENSE +1 -1
  5. data/ext/project_data.yaml +2 -2
  6. data/lib/facter/ec2.rb +2 -2
  7. data/lib/facter/gid.rb +10 -1
  8. data/lib/facter/interfaces.rb +2 -0
  9. data/lib/facter/ipaddress6.rb +1 -1
  10. data/lib/facter/ldom.rb +4 -1
  11. data/lib/facter/macosx.rb +2 -2
  12. data/lib/facter/operatingsystem/linux.rb +13 -1
  13. data/lib/facter/operatingsystem/sunos.rb +1 -1
  14. data/lib/facter/operatingsystem/windows.rb +7 -0
  15. data/lib/facter/physicalprocessorcount.rb +1 -1
  16. data/lib/facter/processor.rb +3 -3
  17. data/lib/facter/processors/os.rb +11 -1
  18. data/lib/facter/rackspace.rb +8 -5
  19. data/lib/facter/rubyplatform.rb +12 -0
  20. data/lib/facter/selinux.rb +9 -9
  21. data/lib/facter/system32.rb +21 -0
  22. data/lib/facter/util/macosx.rb +1 -1
  23. data/lib/facter/util/parser.rb +12 -2
  24. data/lib/facter/util/uptime.rb +1 -1
  25. data/lib/facter/util/virtual.rb +13 -2
  26. data/lib/facter/version.rb +1 -1
  27. data/lib/facter/virtual.rb +5 -3
  28. data/spec/fixtures/ifconfig/linux_ifconfig_all_with_multiple_interfaces_and_fe80 +19 -0
  29. data/spec/fixtures/ifconfig/linux_ifconfig_all_with_multiple_interfaces_and_no_public_ipv6 +18 -0
  30. data/spec/schema/validate_facter_schema.rb +18 -0
  31. data/spec/unit/ec2_spec.rb +18 -6
  32. data/spec/unit/gid_spec.rb +22 -2
  33. data/spec/unit/interfaces_spec.rb +2 -2
  34. data/spec/unit/ipaddress6_spec.rb +24 -6
  35. data/spec/unit/ldom_spec.rb +13 -0
  36. data/spec/unit/operatingsystem/linux_spec.rb +22 -10
  37. data/spec/unit/operatingsystem/sunos_spec.rb +3 -3
  38. data/spec/unit/operatingsystem/windows_spec.rb +21 -0
  39. data/spec/unit/physicalprocessorcount_spec.rb +1 -1
  40. data/spec/unit/processor_spec.rb +1 -1
  41. data/spec/unit/processors/os_spec.rb +15 -1
  42. data/spec/unit/rackspace_spec.rb +3 -3
  43. data/spec/unit/rubyplatform_spec.rb +7 -0
  44. data/spec/unit/selinux_spec.rb +5 -5
  45. data/spec/unit/system32_spec.rb +28 -0
  46. data/spec/unit/util/macosx_spec.rb +1 -1
  47. data/spec/unit/util/parser_spec.rb +36 -3
  48. data/spec/unit/util/uptime_spec.rb +2 -2
  49. data/spec/unit/virtual_spec.rb +52 -26
  50. metadata +647 -645
@@ -7,7 +7,7 @@ describe "Physical processor count fact" do
7
7
  it "should return the value of the 'physicalcount' key of the 'processors' fact on #{kernel}" do
8
8
  Facter.fact(:kernel).stubs(:value).returns("#{kernel}")
9
9
  Facter.fact("processors").stubs(:value).returns({"physicalcount" => 2, "count" => 4})
10
- Facter.fact("physicalprocessorcount").value.should eq "2"
10
+ Facter.fact("physicalprocessorcount").value.should eq 2
11
11
  end
12
12
  end
13
13
  end
@@ -23,7 +23,7 @@ describe "Processor facts" do
23
23
  Facter.fact(:kernel).stubs(:value).returns("linux")
24
24
  Facter.fact("processors").stubs(:value).returns({"count" => 8, "physicalcount" => 4 })
25
25
  Facter.collection.internal_loader.load(:processor)
26
- Facter.fact(:processorcount).value.should eq "8"
26
+ Facter.fact(:processorcount).value.should eq 8
27
27
  end
28
28
  end
29
29
 
@@ -264,7 +264,7 @@ describe Facter::Processors::Darwin, :unless => Facter::Util::Config.is_windows?
264
264
  include_context "processor list"
265
265
 
266
266
  before :each do
267
- Facter::Core::Execution.expects(:exec).with("/usr/sbin/system_profiler -xml SPHardwareDataType").returns(my_fixture_read("darwin-system-profiler"))
267
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/system_profiler -xml SPHardwareDataType 2>/dev/null").returns(my_fixture_read("darwin-system-profiler"))
268
268
  subject.stubs(:query_system_profiler).returns({"number_processors" => 4, "current_processor_speed" => "2.3 GHz"})
269
269
  subject.instance_variable_set :@system_hardware_data, {"number_processors" => 4, "current_processor_speed" => "2.3 GHz"}
270
270
  end
@@ -368,6 +368,20 @@ describe Facter::Processors::OpenBSD do
368
368
  expect(count).to eq 2
369
369
  end
370
370
  end
371
+
372
+ describe "getting the processor speed" do
373
+ it "should delegate to the sysctl utility (GHz)" do
374
+ Facter::Util::POSIX.expects(:sysctl).with("hw.cpuspeed").once.returns("2501")
375
+ speed = subject.get_processor_speed
376
+ expect(speed).to eq "2.5 GHz"
377
+ end
378
+
379
+ it "should delegate to the sysctl utility (MHz)" do
380
+ Facter::Util::POSIX.expects(:sysctl).with("hw.cpuspeed").once.returns("123")
381
+ speed = subject.get_processor_speed
382
+ expect(speed).to eq "123 MHz"
383
+ end
384
+ end
371
385
  end
372
386
 
373
387
  describe Facter::Processors::SunOS do
@@ -10,13 +10,13 @@ describe "rackspace facts" do
10
10
  end
11
11
 
12
12
  it "should set is_rsc to true" do
13
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/provider").returns("Rackspace")
13
+ Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/provider 2> /dev/null").returns("Rackspace")
14
14
  Facter.fact(:is_rsc).value.should == "true"
15
15
  end
16
16
 
17
17
  it "should set the region to dfw" do
18
18
  Facter.fact(:is_rsc).stubs(:value).returns("true")
19
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/region").returns("dfw")
19
+ Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/region 2> /dev/null").returns("dfw")
20
20
  Facter.fact(:rsc_region).value.should == "dfw"
21
21
  end
22
22
 
@@ -33,7 +33,7 @@ describe "rackspace facts" do
33
33
  end
34
34
 
35
35
  it "shouldn't set is_rsc" do
36
- Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/provider").returns("other")
36
+ Facter::Util::Resolution.stubs(:exec).with("/usr/bin/xenstore-read vm-data/provider_data/provider 2> /dev/null").returns("other")
37
37
  Facter.fact(:is_rsc).value.should == nil
38
38
  end
39
39
  end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ruby platform" do
4
+ it "should return the ruby platform" do
5
+ expect(Facter.fact(:rubyplatform).value).to eq(RUBY_PLATFORM.to_s)
6
+ end
7
+ end
@@ -17,7 +17,7 @@ describe "SELinux facts" do
17
17
 
18
18
  FileTest.expects(:exists?).with("/selinux/enforce").returns true
19
19
 
20
- Facter.fact(:selinux).value.should == "true"
20
+ Facter.fact(:selinux).value.should == true
21
21
  end
22
22
 
23
23
  it "and return true with selinuxfs path from /proc" do
@@ -29,7 +29,7 @@ describe "SELinux facts" do
29
29
  FileTest.expects(:exists?).with("/proc/self/attr/current").returns true
30
30
  File.expects(:read).with("/proc/self/attr/current").returns("kernel")
31
31
 
32
- Facter.fact(:selinux).value.should == "true"
32
+ Facter.fact(:selinux).value.should == true
33
33
  end
34
34
 
35
35
  it "and return true with multiple selinuxfs mounts from /proc" do
@@ -44,13 +44,13 @@ describe "SELinux facts" do
44
44
  FileTest.expects(:exists?).with("/proc/self/attr/current").returns true
45
45
  File.expects(:read).with("/proc/self/attr/current").returns("kernel")
46
46
 
47
- Facter.fact(:selinux).value.should == "true"
47
+ Facter.fact(:selinux).value.should == true
48
48
  end
49
49
  end
50
50
 
51
51
  describe "when selinux is present" do
52
52
  before :each do
53
- Facter.fact(:selinux).stubs(:value).returns("true")
53
+ Facter.fact(:selinux).stubs(:value).returns(true)
54
54
  end
55
55
 
56
56
  it "should return true if SELinux policy enabled" do
@@ -59,7 +59,7 @@ describe "SELinux facts" do
59
59
  FileTest.expects(:exists?).with("/selinux/enforce").returns true
60
60
  File.expects(:read).with("/selinux/enforce").returns("1")
61
61
 
62
- Facter.fact(:selinux_enforced).value.should == "true"
62
+ Facter.fact(:selinux_enforced).value.should == true
63
63
  end
64
64
 
65
65
  it "should return an SELinux policy version" do
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "system32 fact" do
4
+ let(:systemroot) { 'D:\Windows' }
5
+ let(:sysnative) { "#{systemroot}\\sysnative" }
6
+ let(:system32) { "#{systemroot}\\system32" }
7
+
8
+ before(:each) do
9
+ Facter.fact(:kernel).stubs(:value).returns("windows")
10
+ ENV['SYSTEMROOT'] = systemroot
11
+ end
12
+
13
+ describe "when running in 32-bit ruby" do
14
+ it "resolves to sysnative" do
15
+ File.expects(:exists?).with(sysnative).returns(true)
16
+
17
+ expect(Facter.fact(:system32).value).to eq(sysnative)
18
+ end
19
+ end
20
+
21
+ describe "when running in 64-bit ruby" do
22
+ it "resolves to system32" do
23
+ File.expects(:exists?).with(sysnative).returns(false)
24
+
25
+ expect(Facter.fact(:system32).value).to eq(system32)
26
+ end
27
+ end
28
+ end
@@ -28,7 +28,7 @@ describe "Facter::Util::Macosx", :unless => Facter::Util::Config.is_windows? do
28
28
  end
29
29
 
30
30
  it "should be able to retrieve profiler data as xml for a given data field" do
31
- Facter::Core::Execution.expects(:exec).with("/usr/sbin/system_profiler -xml foo").returns "yay"
31
+ Facter::Core::Execution.expects(:exec).with("/usr/sbin/system_profiler -xml foo 2>/dev/null").returns "yay"
32
32
  Facter::Util::Macosx.profiler_xml("foo").should == "yay"
33
33
  end
34
34
 
@@ -174,9 +174,9 @@ describe Facter::Util::Parser do
174
174
  describe "powershell parser" do
175
175
  let(:ps1) { "/tmp/foo.ps1" }
176
176
 
177
- def expects_to_parse_powershell(cmd, content, result)
177
+ def expects_to_parse_powershell(cmd, result)
178
178
  Facter::Util::Config.stubs(:is_windows?).returns(true)
179
- Facter::Core::Execution.stubs(:exec).returns(content)
179
+
180
180
  File.stubs(:file?).with(ps1).returns(true)
181
181
 
182
182
  Facter::Util::Parser.parser_for(cmd).results.should == result
@@ -187,7 +187,40 @@ describe Facter::Util::Parser do
187
187
  end
188
188
 
189
189
  it "should parse output from powershell" do
190
- expects_to_parse_powershell(ps1, data_in_txt, data)
190
+ Facter::Core::Execution.stubs(:exec).returns(data_in_txt)
191
+ expects_to_parse_powershell(ps1, data)
192
+ end
193
+
194
+ describe "when executing powershell", :if => Facter::Util::Config.is_windows? do
195
+ let(:sysnative_powershell) { "#{ENV['SYSTEMROOT']}\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe" }
196
+ let(:system32_powershell) { "#{ENV['SYSTEMROOT']}\\system32\\WindowsPowershell\\v1.0\\powershell.exe" }
197
+
198
+ let(:sysnative_regexp) { /^\"#{Regexp.escape(sysnative_powershell)}\"/ }
199
+ let(:system32_regexp) { /^\"#{Regexp.escape(system32_powershell)}\"/ }
200
+ let(:powershell_regexp) { /^\"#{Regexp.escape("powershell.exe")}\"/ }
201
+
202
+ it "prefers the sysnative alias to resolve 64-bit powershell on 32-bit ruby" do
203
+ File.expects(:exists?).with(sysnative_powershell).returns(true)
204
+ Facter::Core::Execution.expects(:exec).with(regexp_matches(sysnative_regexp)).returns(data_in_txt)
205
+
206
+ expects_to_parse_powershell(ps1, data)
207
+ end
208
+
209
+ it "uses system32 if sysnative alias doesn't exist on 64-bit ruby" do
210
+ File.expects(:exists?).with(sysnative_powershell).returns(false)
211
+ File.expects(:exists?).with(system32_powershell).returns(true)
212
+ Facter::Core::Execution.expects(:exec).with(regexp_matches(system32_regexp)).returns(data_in_txt)
213
+
214
+ expects_to_parse_powershell(ps1, data)
215
+ end
216
+
217
+ it "uses 'powershell' as a last resort" do
218
+ File.expects(:exists?).with(sysnative_powershell).returns(false)
219
+ File.expects(:exists?).with(system32_powershell).returns(false)
220
+ Facter::Core::Execution.expects(:exec).with(regexp_matches(powershell_regexp)).returns(data_in_txt)
221
+
222
+ expects_to_parse_powershell(ps1, data)
223
+ end
191
224
  end
192
225
  end
193
226
  end
@@ -98,14 +98,14 @@ describe Facter::Util::Uptime do
98
98
 
99
99
  test_cases.each do |uptime, expected|
100
100
  it "should return #{expected} for #{uptime}" do
101
- Facter::Core::Execution.stubs(:execute).with('uptime 2>/dev/null', {:on_fail => nil}).returns(uptime)
101
+ Facter::Core::Execution.stubs(:execute).with('/usr/bin/uptime 2>/dev/null', {:on_fail => nil}).returns(uptime)
102
102
  Facter.fact(:uptime_seconds).value.should == expected
103
103
  end
104
104
  end
105
105
 
106
106
  describe "nor is 'uptime' command" do
107
107
  before :each do
108
- Facter::Core::Execution.stubs(:execute).with('uptime 2>/dev/null', {:on_fail => nil}).returns(nil)
108
+ Facter::Core::Execution.stubs(:execute).with('/usr/bin/uptime 2>/dev/null', {:on_fail => nil}).returns(nil)
109
109
  end
110
110
 
111
111
  it "should return nil" do
@@ -73,6 +73,26 @@ describe "Virtual fact" do
73
73
  end
74
74
  end
75
75
 
76
+ describe "on FreeBSD" do
77
+ before(:each) do
78
+ Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
79
+ Facter.fact(:operatingsystem).stubs(:value).returns("FreeBSD")
80
+ end
81
+
82
+ it "should be kvm with virtio device pciconf -lv 2>/dev/null" do
83
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n security.jail.jailed').returns('0')
84
+ Facter::Util::Virtual.stubs(:lspci).returns("virtio_pci4@pci0:0:8:0: class=0x020000 card=0x00011af4 chip=0x10001af4 rev=0x00 hdr=0x00")
85
+ Facter.fact(:virtual).value.should == "kvm"
86
+ end
87
+
88
+ it "should be bochs with Bochs vendor name from dmidecode" do
89
+ Facter::Core::Execution.stubs(:exec).with('/sbin/sysctl -n security.jail.jailed').returns('0')
90
+ Facter::Core::Execution.stubs(:exec).with('pciconf -lv 2>/dev/null').returns(nil)
91
+ Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns("Manufacturer: Bochs")
92
+ Facter.fact(:virtual).value.should == "bochs"
93
+ end
94
+ end
95
+
76
96
  describe "on Linux" do
77
97
  before(:each) do
78
98
  Facter.fact(:kernel).stubs(:value).returns("Linux")
@@ -251,7 +271,7 @@ describe "Virtual fact" do
251
271
  Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
252
272
  Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
253
273
  Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
254
- Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
274
+ Facter::Core::Execution.stubs(:exec).with('prtdiag 2>/dev/null').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
255
275
  Facter.fact(:virtual).value.should == "vmware"
256
276
  end
257
277
 
@@ -259,7 +279,7 @@ describe "Virtual fact" do
259
279
  Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
260
280
  Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
261
281
  Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
262
- Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: Parallels Virtual Platform")
282
+ Facter::Core::Execution.stubs(:exec).with('prtdiag 2>/dev/null').returns("System Configuration: Parallels Virtual Platform")
263
283
  Facter.fact(:virtual).value.should == "parallels"
264
284
  end
265
285
 
@@ -267,7 +287,7 @@ describe "Virtual fact" do
267
287
  Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
268
288
  Facter::Core::Execution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
269
289
  Facter::Core::Execution.stubs(:exec).with('dmidecode 2> /dev/null').returns(nil)
270
- Facter::Core::Execution.stubs(:exec).with('prtdiag').returns("System Configuration: innotek GmbH VirtualBox")
290
+ Facter::Core::Execution.stubs(:exec).with('prtdiag 2>/dev/null').returns("System Configuration: innotek GmbH VirtualBox")
271
291
  Facter.fact(:virtual).value.should == "virtualbox"
272
292
  end
273
293
  end
@@ -388,139 +408,145 @@ describe "is_virtual fact" do
388
408
  it "should be virtual when running on xen" do
389
409
  Facter.fact(:kernel).stubs(:value).returns("Linux")
390
410
  Facter.fact(:virtual).stubs(:value).returns("xenu")
391
- Facter.fact(:is_virtual).value.should == "true"
411
+ Facter.fact(:is_virtual).value.should == true
392
412
  end
393
413
 
394
414
  it "should be false when running on xen0" do
395
415
  Facter.fact(:kernel).stubs(:value).returns("Linux")
396
416
  Facter.fact(:virtual).stubs(:value).returns("xen0")
397
- Facter.fact(:is_virtual).value.should == "false"
417
+ Facter.fact(:is_virtual).value.should == false
398
418
  end
399
419
 
400
420
  it "should be true when running on xenhvm" do
401
421
  Facter.fact(:kernel).stubs(:value).returns("Linux")
402
422
  Facter.fact(:virtual).stubs(:value).returns("xenhvm")
403
- Facter.fact(:is_virtual).value.should == "true"
423
+ Facter.fact(:is_virtual).value.should == true
404
424
  end
405
425
 
406
426
  it "should be false when running on physical" do
407
427
  Facter.fact(:kernel).stubs(:value).returns("Linux")
408
428
  Facter.fact(:virtual).stubs(:value).returns("physical")
409
- Facter.fact(:is_virtual).value.should == "false"
429
+ Facter.fact(:is_virtual).value.should == false
410
430
  end
411
431
 
412
432
  it "should be true when running on vmware" do
413
433
  Facter.fact(:kernel).stubs(:value).returns("Linux")
414
434
  Facter.fact(:virtual).stubs(:value).returns("vmware")
415
- Facter.fact(:is_virtual).value.should == "true"
435
+ Facter.fact(:is_virtual).value.should == true
416
436
  end
417
437
 
418
438
  it "should be true when running on virtualbox" do
419
439
  Facter.fact(:kernel).stubs(:value).returns("Linux")
420
440
  Facter.fact(:virtual).stubs(:value).returns("virtualbox")
421
- Facter.fact(:is_virtual).value.should == "true"
441
+ Facter.fact(:is_virtual).value.should == true
422
442
  end
423
443
 
424
444
  it "should be true when running on openvzve" do
425
445
  Facter.fact(:kernel).stubs(:value).returns("Linux")
426
446
  Facter.fact(:virtual).stubs(:value).returns("openvzve")
427
- Facter.fact(:is_virtual).value.should == "true"
447
+ Facter.fact(:is_virtual).value.should == true
428
448
  end
429
449
 
430
450
  it "should be true when running on vserver" do
431
451
  Facter.fact(:kernel).stubs(:value).returns("Linux")
432
452
  Facter.fact(:virtual).stubs(:value).returns("vserver")
433
- Facter.fact(:is_virtual).value.should == "true"
453
+ Facter.fact(:is_virtual).value.should == true
434
454
  end
435
455
 
436
456
  it "should be true when running on kvm" do
437
457
  Facter.fact(:kernel).stubs(:value).returns("Linux")
438
458
  Facter.fact(:virtual).stubs(:value).returns("kvm")
439
- Facter.fact(:is_virtual).value.should == "true"
459
+ Facter.fact(:is_virtual).value.should == true
440
460
  end
441
461
 
442
462
  it "should be true when running in jail" do
443
463
  Facter.fact(:kernel).stubs(:value).returns("FreeBSD")
444
464
  Facter.fact(:virtual).stubs(:value).returns("jail")
445
- Facter.fact(:is_virtual).value.should == "true"
465
+ Facter.fact(:is_virtual).value.should == true
446
466
  end
447
467
 
448
468
  it "should be true when running in zone" do
449
469
  Facter.fact(:kernel).stubs(:value).returns("SunOS")
450
470
  Facter.fact(:virtual).stubs(:value).returns("zone")
451
- Facter.fact(:is_virtual).value.should == "true"
471
+ Facter.fact(:is_virtual).value.should == true
452
472
  end
453
473
 
454
474
  it "should be true when running on hp-vm" do
455
475
  Facter.fact(:kernel).stubs(:value).returns("HP-UX")
456
476
  Facter.fact(:virtual).stubs(:value).returns("hpvm")
457
- Facter.fact(:is_virtual).value.should == "true"
477
+ Facter.fact(:is_virtual).value.should == true
458
478
  end
459
479
 
460
480
  it "should be true when running on S390" do
461
481
  Facter.fact(:architecture).stubs(:value).returns("s390x")
462
482
  Facter.fact(:kernel).stubs(:value).returns("Linux")
463
483
  Facter.fact(:virtual).stubs(:value).returns("zlinux")
464
- Facter.fact(:is_virtual).value.should == "true"
484
+ Facter.fact(:is_virtual).value.should == true
465
485
  end
466
486
 
467
487
  it "should be true when running on parallels" do
468
488
  Facter.fact(:kernel).stubs(:value).returns("Darwin")
469
489
  Facter.fact(:virtual).stubs(:value).returns("parallels")
470
- Facter.fact(:is_virtual).value.should == "true"
490
+ Facter.fact(:is_virtual).value.should == true
471
491
  end
472
492
 
473
493
  it "should be false on vmware_server" do
474
494
  Facter.fact(:kernel).stubs(:value).returns("Linux")
475
495
  Facter.fact(:virtual).stubs(:value).returns("vmware_server")
476
- Facter.fact(:is_virtual).value.should == "false"
496
+ Facter.fact(:is_virtual).value.should == false
477
497
  end
478
498
 
479
499
  it "should be false on openvz host nodes" do
480
500
  Facter.fact(:kernel).stubs(:value).returns("Linux")
481
501
  Facter.fact(:virtual).stubs(:value).returns("openvzhn")
482
- Facter.fact(:is_virtual).value.should == "false"
502
+ Facter.fact(:is_virtual).value.should == false
483
503
  end
484
504
 
485
505
  it "should be false on vserver host nodes" do
486
506
  Facter.fact(:kernel).stubs(:value).returns("Linux")
487
507
  Facter.fact(:virtual).stubs(:value).returns("vserver_host")
488
- Facter.fact(:is_virtual).value.should == "false"
508
+ Facter.fact(:is_virtual).value.should == false
489
509
  end
490
510
 
491
511
  it "should be true when running on hyperv" do
492
512
  Facter.fact(:kernel).stubs(:value).returns("Linux")
493
513
  Facter.fact(:virtual).stubs(:value).returns("hyperv")
494
- Facter.fact(:is_virtual).value.should == "true"
514
+ Facter.fact(:is_virtual).value.should == true
495
515
  end
496
516
 
497
517
  it "should be true when running on rhev" do
498
518
  Facter.fact(:kernel).stubs(:value).returns("Linux")
499
519
  Facter.fact(:virtual).stubs(:value).returns("rhev")
500
- Facter.fact(:is_virtual).value.should == "true"
520
+ Facter.fact(:is_virtual).value.should == true
501
521
  end
502
522
 
503
523
  it "should be true when running on ovirt" do
504
524
  Facter.fact(:kernel).stubs(:value).returns("Linux")
505
525
  Facter.fact(:virtual).stubs(:value).returns("ovirt")
506
- Facter.fact(:is_virtual).value.should == "true"
526
+ Facter.fact(:is_virtual).value.should == true
507
527
  end
508
528
 
509
529
  it "should be true when running on gce" do
510
530
  Facter.fact(:kernel).stubs(:value).returns("Linux")
511
531
  Facter.fact(:virtual).stubs(:value).returns("gce")
512
- Facter.fact(:is_virtual).value.should == "true"
532
+ Facter.fact(:is_virtual).value.should == true
513
533
  end
514
534
 
515
535
  it "should be true when running in LXC" do
516
536
  Facter.fact(:kernel).stubs(:value).returns("Linux")
517
537
  Facter.fact(:virtual).stubs(:value).returns("lxc")
518
- Facter.fact(:is_virtual).value.should == "true"
538
+ Facter.fact(:is_virtual).value.should == true
519
539
  end
520
540
 
521
541
  it "should be true when running in docker" do
522
542
  Facter.fact(:kernel).stubs(:value).returns("Linux")
523
543
  Facter.fact(:virtual).stubs(:value).returns("docker")
524
- Facter.fact(:is_virtual).value.should == "true"
544
+ Facter.fact(:is_virtual).value.should == true
545
+ end
546
+
547
+ it "should be true when running in bochs" do
548
+ Facter.fact(:kernel).stubs(:value).returns("Linux")
549
+ Facter.fact(:virtual).stubs(:value).returns("bochs")
550
+ Facter.fact(:is_virtual).value.should == true
525
551
  end
526
552
  end