facter 1.6.6 → 1.6.7
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 +7 -0
- data/install.rb +6 -6
- data/lib/facter.rb +1 -1
- data/lib/facter/processor.rb +12 -1
- data/lib/facter/util/processor.rb +19 -0
- data/lib/facter/virtual.rb +1 -1
- data/spec/fixtures/unit/util/processor/solaris-i86pc +28 -0
- data/spec/fixtures/unit/util/processor/solaris-sun4u +151 -0
- data/spec/unit/util/processor_spec.rb +24 -1
- data/spec/unit/virtual_spec.rb +21 -21
- metadata +7 -5
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
1.6.7
|
2
|
+
===
|
3
|
+
ab9e26c Updating CHANGELOG and lib/facter.rb for Facter 1.6.7rc1
|
4
|
+
bdbf332 (#12720) Add Solaris CPU info to 'processorN' fact.
|
5
|
+
a7f5924 (#12813) Redirect lspci output to /dev/null
|
6
|
+
6ec2863 (#12669) Preserve timestamps when installing files
|
7
|
+
|
1
8
|
1.6.6
|
2
9
|
===
|
3
10
|
e046144 Updated CHANGELOG for 1.6.6rc2
|
data/install.rb
CHANGED
@@ -103,7 +103,7 @@ def do_libs(libs, strip = 'lib/')
|
|
103
103
|
op = File.dirname(olf)
|
104
104
|
FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
|
105
105
|
FileUtils.chmod(0755, op)
|
106
|
-
FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
|
106
|
+
FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -114,7 +114,7 @@ def do_man(man, strip = 'man/')
|
|
114
114
|
om = File.dirname(omf)
|
115
115
|
FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
|
116
116
|
FileUtils.chmod(0755, om)
|
117
|
-
FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
|
117
|
+
FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
|
118
118
|
gzip = %x{which gzip}
|
119
119
|
gzip.chomp!
|
120
120
|
%x{#{gzip} -f #{omf}}
|
@@ -400,12 +400,12 @@ def install_binfile(from, op_file, target)
|
|
400
400
|
installed_wrapper = false
|
401
401
|
|
402
402
|
if File.exists?("#{from}.bat")
|
403
|
-
FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
|
403
|
+
FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
|
404
404
|
installed_wrapper = true
|
405
405
|
end
|
406
406
|
|
407
407
|
if File.exists?("#{from}.cmd")
|
408
|
-
FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :verbose => true)
|
408
|
+
FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true)
|
409
409
|
installed_wrapper = true
|
410
410
|
end
|
411
411
|
|
@@ -419,13 +419,13 @@ set RUBY_BIN=%RUBY_BIN:\\=/%
|
|
419
419
|
"%RUBY_BIN%ruby.exe" -x "%RUBY_BIN%facter" %*
|
420
420
|
EOS
|
421
421
|
File.open(tmp_file2.path, "w") { |cw| cw.puts cwv }
|
422
|
-
FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
|
422
|
+
FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
|
423
423
|
|
424
424
|
tmp_file2.unlink
|
425
425
|
installed_wrapper = true
|
426
426
|
end
|
427
427
|
end
|
428
|
-
FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :verbose => true)
|
428
|
+
FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true)
|
429
429
|
tmp_file.unlink
|
430
430
|
end
|
431
431
|
|
data/lib/facter.rb
CHANGED
data/lib/facter/processor.rb
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
#
|
6
6
|
# Resolution:
|
7
7
|
# On Linux and kFreeBSD, parse '/proc/cpuinfo' for each processor.
|
8
|
-
# On AIX, parse the output of 'lsdev' for
|
8
|
+
# On AIX, parse the output of 'lsdev' for its processor section.
|
9
|
+
# On Solaris, parse the output of 'kstat' for each processor.
|
9
10
|
# On OpenBSD, use 'uname -p' and the sysctl variable for 'hw.ncpu' for CPU
|
10
11
|
# count.
|
11
12
|
#
|
@@ -81,6 +82,7 @@ end
|
|
81
82
|
## (but we need them inside the Facter.add block above for tests on processorcount to work)
|
82
83
|
processor_list = Facter::Util::Processor.enum_cpuinfo
|
83
84
|
processor_list_aix = Facter::Util::Processor.enum_lsdev
|
85
|
+
processor_list_sunos = Facter::Util::Processor.enum_kstat
|
84
86
|
|
85
87
|
if processor_list.length != 0
|
86
88
|
processor_list.each_with_index do |desc, i|
|
@@ -100,6 +102,15 @@ elsif processor_list_aix.length != 0
|
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|
105
|
+
elsif processor_list_sunos.length != 0
|
106
|
+
processor_list_sunos.each_with_index do |desc, i|
|
107
|
+
Facter.add("Processor#{i}") do
|
108
|
+
confine :kernel => [ :sunos ]
|
109
|
+
setcode do
|
110
|
+
desc
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
103
114
|
end
|
104
115
|
|
105
116
|
if Facter.value(:kernel) == "windows"
|
@@ -85,4 +85,23 @@ module Facter::Util::Processor
|
|
85
85
|
end
|
86
86
|
processor_list
|
87
87
|
end
|
88
|
+
|
89
|
+
def self.enum_kstat
|
90
|
+
processor_num = -1
|
91
|
+
processor_list = []
|
92
|
+
Thread::exclusive do
|
93
|
+
kstat = Facter::Util::Resolution.exec('/usr/bin/kstat cpu_info')
|
94
|
+
if kstat
|
95
|
+
kstat.each_line do |l|
|
96
|
+
if l =~ /cpu_info(\d+)/
|
97
|
+
processor_num = $1.to_i
|
98
|
+
elsif l =~ /brand\s+(.*)\s*$/
|
99
|
+
processor_list[processor_num] = $1 unless processor_num == -1
|
100
|
+
processor_num = -1
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
processor_list
|
106
|
+
end
|
88
107
|
end
|
data/lib/facter/virtual.rb
CHANGED
@@ -89,7 +89,7 @@ Facter.add("virtual") do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
if result == "physical"
|
92
|
-
output = Facter::Util::Resolution.exec('lspci')
|
92
|
+
output = Facter::Util::Resolution.exec('lspci 2>/dev/null')
|
93
93
|
if not output.nil?
|
94
94
|
output.each_line do |p|
|
95
95
|
# --- look for the vmware video card to determine if it is virtual => vmware.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module: cpu_info instance: 0
|
2
|
+
name: cpu_info0 class: misc
|
3
|
+
brand Intel(r) Core(tm) i5 CPU M 450 @ 2.40GHz
|
4
|
+
cache_id 0
|
5
|
+
chip_id 0
|
6
|
+
clock_MHz 2375
|
7
|
+
clog_id 0
|
8
|
+
core_id 0
|
9
|
+
cpu_type i386
|
10
|
+
crtime 70.899819526
|
11
|
+
current_clock_Hz 2374891267
|
12
|
+
current_cstate 0
|
13
|
+
family 6
|
14
|
+
fpu_type i387 compatible
|
15
|
+
implementation x86 (GenuineIntel family 6 model 37 step 5 clock 2375 MHz)
|
16
|
+
model 37
|
17
|
+
ncore_per_chip 1
|
18
|
+
ncpu_per_chip 1
|
19
|
+
pg_id -1
|
20
|
+
pkg_core_id 0
|
21
|
+
snaptime 2279.514858392
|
22
|
+
state on-line
|
23
|
+
state_begin 1329488796
|
24
|
+
stepping 5
|
25
|
+
supported_frequencies_Hz 2374891267
|
26
|
+
supported_max_cstates 1
|
27
|
+
vendor_id GenuineIntel
|
28
|
+
|
@@ -0,0 +1,151 @@
|
|
1
|
+
module: cpu_info instance: 0
|
2
|
+
name: cpu_info0 class: misc
|
3
|
+
brand SPARC64-VII
|
4
|
+
chip_id 1024
|
5
|
+
clock_MHz 2520
|
6
|
+
core_id 0
|
7
|
+
cpu_fru hc:///component=/MBU_A
|
8
|
+
cpu_type sparcv9
|
9
|
+
crtime 92.5418505
|
10
|
+
current_clock_Hz 2520000000
|
11
|
+
device_ID 175931055444225
|
12
|
+
fpu_type sparcv9
|
13
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
14
|
+
pg_id 1
|
15
|
+
snaptime 15277456.9660361
|
16
|
+
state on-line
|
17
|
+
state_begin 1314212380
|
18
|
+
supported_frequencies_Hz 2520000000
|
19
|
+
|
20
|
+
module: cpu_info instance: 1
|
21
|
+
name: cpu_info1 class: misc
|
22
|
+
brand SPARC64-VII
|
23
|
+
chip_id 1024
|
24
|
+
clock_MHz 2520
|
25
|
+
core_id 0
|
26
|
+
cpu_fru hc:///component=/MBU_A
|
27
|
+
cpu_type sparcv9
|
28
|
+
crtime 93.3416172
|
29
|
+
current_clock_Hz 2520000000
|
30
|
+
device_ID 175931055444225
|
31
|
+
fpu_type sparcv9
|
32
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
33
|
+
pg_id 1
|
34
|
+
snaptime 15277456.9667477
|
35
|
+
state on-line
|
36
|
+
state_begin 1314212381
|
37
|
+
supported_frequencies_Hz 2520000000
|
38
|
+
|
39
|
+
module: cpu_info instance: 2
|
40
|
+
name: cpu_info2 class: misc
|
41
|
+
brand SPARC64-VII
|
42
|
+
chip_id 1024
|
43
|
+
clock_MHz 2520
|
44
|
+
core_id 2
|
45
|
+
cpu_fru hc:///component=/MBU_A
|
46
|
+
cpu_type sparcv9
|
47
|
+
crtime 93.3433262
|
48
|
+
current_clock_Hz 2520000000
|
49
|
+
device_ID 175931055444225
|
50
|
+
fpu_type sparcv9
|
51
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
52
|
+
pg_id 4
|
53
|
+
snaptime 15277456.9671387
|
54
|
+
state on-line
|
55
|
+
state_begin 1314212381
|
56
|
+
supported_frequencies_Hz 2520000000
|
57
|
+
|
58
|
+
module: cpu_info instance: 3
|
59
|
+
name: cpu_info3 class: misc
|
60
|
+
brand SPARC64-VII
|
61
|
+
chip_id 1024
|
62
|
+
clock_MHz 2520
|
63
|
+
core_id 2
|
64
|
+
cpu_fru hc:///component=/MBU_A
|
65
|
+
cpu_type sparcv9
|
66
|
+
crtime 93.3449653
|
67
|
+
current_clock_Hz 2520000000
|
68
|
+
device_ID 175931055444225
|
69
|
+
fpu_type sparcv9
|
70
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
71
|
+
pg_id 4
|
72
|
+
snaptime 15277456.9675197
|
73
|
+
state on-line
|
74
|
+
state_begin 1314212381
|
75
|
+
supported_frequencies_Hz 2520000000
|
76
|
+
|
77
|
+
module: cpu_info instance: 4
|
78
|
+
name: cpu_info4 class: misc
|
79
|
+
brand SPARC64-VII
|
80
|
+
chip_id 1024
|
81
|
+
clock_MHz 2520
|
82
|
+
core_id 4
|
83
|
+
cpu_fru hc:///component=/MBU_A
|
84
|
+
cpu_type sparcv9
|
85
|
+
crtime 93.3465648
|
86
|
+
current_clock_Hz 2520000000
|
87
|
+
device_ID 175931055444225
|
88
|
+
fpu_type sparcv9
|
89
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
90
|
+
pg_id 5
|
91
|
+
snaptime 15277456.9678953
|
92
|
+
state on-line
|
93
|
+
state_begin 1314212381
|
94
|
+
supported_frequencies_Hz 2520000000
|
95
|
+
|
96
|
+
module: cpu_info instance: 5
|
97
|
+
name: cpu_info5 class: misc
|
98
|
+
brand SPARC64-VII
|
99
|
+
chip_id 1024
|
100
|
+
clock_MHz 2520
|
101
|
+
core_id 4
|
102
|
+
cpu_fru hc:///component=/MBU_A
|
103
|
+
cpu_type sparcv9
|
104
|
+
crtime 93.3481605
|
105
|
+
current_clock_Hz 2520000000
|
106
|
+
device_ID 175931055444225
|
107
|
+
fpu_type sparcv9
|
108
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
109
|
+
pg_id 5
|
110
|
+
snaptime 15277456.968269
|
111
|
+
state on-line
|
112
|
+
state_begin 1314212381
|
113
|
+
supported_frequencies_Hz 2520000000
|
114
|
+
|
115
|
+
module: cpu_info instance: 6
|
116
|
+
name: cpu_info6 class: misc
|
117
|
+
brand SPARC64-VII
|
118
|
+
chip_id 1024
|
119
|
+
clock_MHz 2520
|
120
|
+
core_id 6
|
121
|
+
cpu_fru hc:///component=/MBU_A
|
122
|
+
cpu_type sparcv9
|
123
|
+
crtime 93.3497654
|
124
|
+
current_clock_Hz 2520000000
|
125
|
+
device_ID 175931055444225
|
126
|
+
fpu_type sparcv9
|
127
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
128
|
+
pg_id 6
|
129
|
+
snaptime 15277456.9686422
|
130
|
+
state on-line
|
131
|
+
state_begin 1314212381
|
132
|
+
supported_frequencies_Hz 2520000000
|
133
|
+
|
134
|
+
module: cpu_info instance: 7
|
135
|
+
name: cpu_info7 class: misc
|
136
|
+
brand SPARC64-VII
|
137
|
+
chip_id 1024
|
138
|
+
clock_MHz 2520
|
139
|
+
core_id 6
|
140
|
+
cpu_fru hc:///component=/MBU_A
|
141
|
+
cpu_type sparcv9
|
142
|
+
crtime 93.3513776
|
143
|
+
current_clock_Hz 2520000000
|
144
|
+
device_ID 175931055444225
|
145
|
+
fpu_type sparcv9
|
146
|
+
implementation SPARC64-VII (portid 1024 impl 0x7 ver 0x91 clock 2520 MHz)
|
147
|
+
pg_id 6
|
148
|
+
snaptime 15277456.9690115
|
149
|
+
state on-line
|
150
|
+
state_begin 1314212381
|
151
|
+
supported_frequencies_Hz 2520000000
|
@@ -43,7 +43,7 @@ describe Facter::Util::Processor do
|
|
43
43
|
Facter.fact(:architecture).stubs(:value).returns("amd64")
|
44
44
|
File.stubs(:exists?).with("/proc/cpuinfo").returns(true)
|
45
45
|
File.stubs(:readlines).with("/proc/cpuinfo").returns(cpuinfo_fixture("amd64quad"))
|
46
|
-
|
46
|
+
|
47
47
|
Facter::Util::Processor.enum_cpuinfo[0].should == "Quad-Core AMD Opteron(tm) Processor 2374 HE"
|
48
48
|
Facter::Util::Processor.enum_cpuinfo[1].should == "Quad-Core AMD Opteron(tm) Processor 2374 HE"
|
49
49
|
Facter::Util::Processor.enum_cpuinfo[2].should == "Quad-Core AMD Opteron(tm) Processor 2374 HE"
|
@@ -57,4 +57,27 @@ describe Facter::Util::Processor do
|
|
57
57
|
|
58
58
|
Facter::Util::Processor.enum_lsdev[0].should == "PowerPC_POWER3"
|
59
59
|
end
|
60
|
+
|
61
|
+
it "should get the processor description on Solaris (x86)" do
|
62
|
+
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
63
|
+
Facter.fact(:architecture).stubs(:value).returns("i86pc")
|
64
|
+
Facter::Util::Resolution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-i86pc"))
|
65
|
+
|
66
|
+
Facter::Util::Processor.enum_kstat[0].should == "Intel(r) Core(tm) i5 CPU M 450 @ 2.40GHz"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should get the processor description on Solaris (SPARC64)" do
|
70
|
+
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
71
|
+
Facter.fact(:architecture).stubs(:value).returns("sun4u")
|
72
|
+
Facter::Util::Resolution.stubs(:exec).with("/usr/bin/kstat cpu_info").returns(my_fixture_read("solaris-sun4u"))
|
73
|
+
|
74
|
+
Facter::Util::Processor.enum_kstat[0].should == "SPARC64-VII"
|
75
|
+
Facter::Util::Processor.enum_kstat[1].should == "SPARC64-VII"
|
76
|
+
Facter::Util::Processor.enum_kstat[2].should == "SPARC64-VII"
|
77
|
+
Facter::Util::Processor.enum_kstat[3].should == "SPARC64-VII"
|
78
|
+
Facter::Util::Processor.enum_kstat[4].should == "SPARC64-VII"
|
79
|
+
Facter::Util::Processor.enum_kstat[5].should == "SPARC64-VII"
|
80
|
+
Facter::Util::Processor.enum_kstat[6].should == "SPARC64-VII"
|
81
|
+
Facter::Util::Processor.enum_kstat[7].should == "SPARC64-VII"
|
82
|
+
end
|
60
83
|
end
|
data/spec/unit/virtual_spec.rb
CHANGED
@@ -81,33 +81,33 @@ describe "Virtual fact" do
|
|
81
81
|
Facter.fact(:architecture).stubs(:value).returns(true)
|
82
82
|
end
|
83
83
|
|
84
|
-
it "should be parallels with Parallels vendor id from lspci" do
|
84
|
+
it "should be parallels with Parallels vendor id from lspci 2>/dev/null" do
|
85
85
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
86
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("01:00.0 VGA compatible controller: Unknown device 1ab8:4005")
|
86
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("01:00.0 VGA compatible controller: Unknown device 1ab8:4005")
|
87
87
|
Facter.fact(:virtual).value.should == "parallels"
|
88
88
|
end
|
89
89
|
|
90
|
-
it "should be parallels with Parallels vendor name from lspci" do
|
90
|
+
it "should be parallels with Parallels vendor name from lspci 2>/dev/null" do
|
91
91
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
92
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("01:00.0 VGA compatible controller: Parallels Display Adapter")
|
92
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("01:00.0 VGA compatible controller: Parallels Display Adapter")
|
93
93
|
Facter.fact(:virtual).value.should == "parallels"
|
94
94
|
end
|
95
95
|
|
96
|
-
it "should be vmware with VMware vendor name from lspci" do
|
96
|
+
it "should be vmware with VMware vendor name from lspci 2>/dev/null" do
|
97
97
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
98
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter")
|
98
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter")
|
99
99
|
Facter.fact(:virtual).value.should == "vmware"
|
100
100
|
end
|
101
101
|
|
102
|
-
it "should be virtualbox with VirtualBox vendor name from lspci" do
|
102
|
+
it "should be virtualbox with VirtualBox vendor name from lspci 2>/dev/null" do
|
103
103
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
104
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter")
|
104
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter")
|
105
105
|
Facter.fact(:virtual).value.should == "virtualbox"
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should be vmware with VMWare vendor name from dmidecode" do
|
109
109
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
110
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
110
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
111
111
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("On Board Device 1 Information\nType: Video\nStatus: Disabled\nDescription: VMware SVGA II")
|
112
112
|
Facter.fact(:virtual).value.should == "vmware"
|
113
113
|
end
|
@@ -131,42 +131,42 @@ describe "Virtual fact" do
|
|
131
131
|
Facter.fact(:virtual).value.should == "xenu"
|
132
132
|
end
|
133
133
|
|
134
|
-
it "should be xenhvm with Xen HVM vendor name from lspci" do
|
134
|
+
it "should be xenhvm with Xen HVM vendor name from lspci 2>/dev/null" do
|
135
135
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
136
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)")
|
136
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)")
|
137
137
|
Facter.fact(:virtual).value.should == "xenhvm"
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should be xenhvm with Xen HVM vendor name from dmidecode" do
|
141
141
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
142
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
142
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
143
143
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("System Information\nManufacturer: Xen\nProduct Name: HVM domU")
|
144
144
|
Facter.fact(:virtual).value.should == "xenhvm"
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should be parallels with Parallels vendor name from dmidecode" do
|
148
148
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
149
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
149
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
150
150
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("On Board Device Information\nType: Video\nStatus: Disabled\nDescription: Parallels Video Adapter")
|
151
151
|
Facter.fact(:virtual).value.should == "parallels"
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should be virtualbox with VirtualBox vendor name from dmidecode" do
|
155
155
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
156
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
156
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
157
157
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("BIOS Information\nVendor: innotek GmbH\nVersion: VirtualBox\n\nSystem Information\nManufacturer: innotek GmbH\nProduct Name: VirtualBox\nFamily: Virtual Machine")
|
158
158
|
Facter.fact(:virtual).value.should == "virtualbox"
|
159
159
|
end
|
160
160
|
|
161
|
-
it "should be hyperv with Microsoft vendor name from lspci" do
|
161
|
+
it "should be hyperv with Microsoft vendor name from lspci 2>/dev/null" do
|
162
162
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
163
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns("00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA")
|
163
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns("00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA")
|
164
164
|
Facter.fact(:virtual).value.should == "hyperv"
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should be hyperv with Microsoft vendor name from dmidecode" do
|
168
168
|
Facter.fact(:kernel).stubs(:value).returns("Linux")
|
169
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
169
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
170
170
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns("System Information\nManufacturer: Microsoft Corporation\nProduct Name: Virtual Machine")
|
171
171
|
Facter.fact(:virtual).value.should == "hyperv"
|
172
172
|
end
|
@@ -180,7 +180,7 @@ describe "Virtual fact" do
|
|
180
180
|
it "should be vmware with VMWare vendor name from prtdiag" do
|
181
181
|
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
182
182
|
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
|
183
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
183
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
184
184
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
|
185
185
|
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: VMware, Inc. VMware Virtual Platform")
|
186
186
|
Facter.fact(:virtual).value.should == "vmware"
|
@@ -189,7 +189,7 @@ describe "Virtual fact" do
|
|
189
189
|
it "should be parallels with Parallels vendor name from prtdiag" do
|
190
190
|
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
191
191
|
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
|
192
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
192
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
193
193
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
|
194
194
|
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: Parallels Virtual Platform")
|
195
195
|
Facter.fact(:virtual).value.should == "parallels"
|
@@ -198,7 +198,7 @@ describe "Virtual fact" do
|
|
198
198
|
it "should be virtualbox with VirtualBox vendor name from prtdiag" do
|
199
199
|
Facter.fact(:kernel).stubs(:value).returns("SunOS")
|
200
200
|
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
|
201
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
201
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
202
202
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
|
203
203
|
Facter::Util::Resolution.stubs(:exec).with('prtdiag').returns("System Configuration: innotek GmbH VirtualBox")
|
204
204
|
Facter.fact(:virtual).value.should == "virtualbox"
|
@@ -210,7 +210,7 @@ describe "Virtual fact" do
|
|
210
210
|
Facter::Util::Resolution.stubs(:exec).with("vmware -v").returns false
|
211
211
|
Facter.fact(:kernel).stubs(:value).returns("OpenBSD")
|
212
212
|
Facter.fact(:hardwaremodel).stubs(:value).returns(nil)
|
213
|
-
Facter::Util::Resolution.stubs(:exec).with('lspci').returns(nil)
|
213
|
+
Facter::Util::Resolution.stubs(:exec).with('lspci 2>/dev/null').returns(nil)
|
214
214
|
Facter::Util::Resolution.stubs(:exec).with('dmidecode').returns(nil)
|
215
215
|
end
|
216
216
|
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 1.6.
|
9
|
+
- 7
|
10
|
+
version: 1.6.7
|
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-03-29 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: You can prove anything with facts!
|
@@ -189,6 +189,8 @@ files:
|
|
189
189
|
- spec/fixtures/unit/util/manufacturer/opensolaris_smbios
|
190
190
|
- spec/fixtures/unit/util/manufacturer/solaris_sunfire_v120_prtdiag
|
191
191
|
- spec/fixtures/unit/util/manufacturer/solaris_t5220_prtdiag
|
192
|
+
- spec/fixtures/unit/util/processor/solaris-i86pc
|
193
|
+
- spec/fixtures/unit/util/processor/solaris-sun4u
|
192
194
|
- spec/fixtures/unit/util/uptime/kstat_boot_time
|
193
195
|
- spec/fixtures/unit/util/uptime/sysctl_kern_boottime_darwin
|
194
196
|
- spec/fixtures/unit/util/uptime/sysctl_kern_boottime_openbsd
|
@@ -277,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
279
|
requirements: []
|
278
280
|
|
279
281
|
rubyforge_project: facter
|
280
|
-
rubygems_version: 1.8.
|
282
|
+
rubygems_version: 1.8.15
|
281
283
|
signing_key:
|
282
284
|
specification_version: 3
|
283
285
|
summary: Facter, a system inventory tool
|