ohai 8.8.0 → 8.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/lib/ohai/plugins/vmware.rb +4 -3
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +0 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +242 -93
- data/spec/unit/plugins/vmware_spec.rb +49 -33
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1414aa396729e3e5d9345bc1219a066485bed692
|
4
|
+
data.tar.gz: 5ec38bc64cee9310d3ed0ec2b1a25c9ed8cbddc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f69711502fe20ff5e64be54bcdea36b08c68204180a2eace90909fc1622beba40dcd55653bcae8457d2ada4bcd0388ea4f7c0faf1f164570dcf60735ee9810
|
7
|
+
data.tar.gz: ec2700012b9d071d6fdfb5d6f2f08dad4ab1624a4d7f52ae3c93e6405972d4dba7d9f0f0c25f5c5367a04ec14265e6fcdb4dde783bac266441046b1510528b73
|
data/README.md
CHANGED
@@ -54,13 +54,11 @@ You can run individual test files by running the rspec executable:
|
|
54
54
|
Ohai has some Rake tasks for doing various things.
|
55
55
|
|
56
56
|
rake -T
|
57
|
-
rake
|
58
|
-
rake
|
59
|
-
rake install
|
60
|
-
rake
|
61
|
-
rake
|
62
|
-
rake repackage # Force a rebuild of the package files
|
63
|
-
rake spec # Run specs
|
57
|
+
rake build # Build the gem file ohai-$VERSION.gem
|
58
|
+
rake install # install the gem locally
|
59
|
+
rake install:local # install the gem locally without network access
|
60
|
+
rake release # Create tag $VERSION, build gem, and push to Rubygems
|
61
|
+
rake spec # Run RSpec tests
|
64
62
|
|
65
63
|
($VERSION is the current version, from the GemSpec in Rakefile)
|
66
64
|
|
data/lib/ohai/plugins/vmware.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
|
-
# Author:: "Dan Robinson" <drobinson@
|
2
|
+
# Author:: "Dan Robinson" <drobinson@chef.io>
|
3
3
|
# Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
|
4
|
-
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
4
|
+
# Copyright:: Copyright (c) 2014-2015 Chef Software, Inc.
|
5
5
|
# Copyright (C) 2015 IBM Corp.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
@@ -33,6 +33,7 @@
|
|
33
33
|
|
34
34
|
Ohai.plugin(:VMware) do
|
35
35
|
provides "vmware"
|
36
|
+
depends "virtualization"
|
36
37
|
|
37
38
|
def from_cmd(cmd)
|
38
39
|
so = shell_out(cmd)
|
@@ -67,7 +68,7 @@ Ohai.plugin(:VMware) do
|
|
67
68
|
end
|
68
69
|
|
69
70
|
collect_data(:linux) do
|
70
|
-
get_vm_attributes("/usr/bin/vmware-toolbox-cmd")
|
71
|
+
get_vm_attributes("/usr/bin/vmware-toolbox-cmd") if virtualization[:systems][:vmware]
|
71
72
|
end
|
72
73
|
|
73
74
|
end
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008
|
3
|
+
# Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -16,24 +16,25 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
+
require 'tempfile'
|
19
20
|
|
20
21
|
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
21
22
|
|
22
23
|
shared_examples "Common cpu info" do |total_cpu, real_cpu|
|
23
24
|
describe "cpu" do
|
24
25
|
it "has cpu[:total] equals to #{total_cpu}" do
|
25
|
-
|
26
|
-
expect(
|
26
|
+
plugin.run
|
27
|
+
expect(plugin[:cpu][:total]).to eq(total_cpu)
|
27
28
|
end
|
28
29
|
|
29
30
|
it "has cpu[:real] equals to #{real_cpu}" do
|
30
|
-
|
31
|
-
expect(
|
31
|
+
plugin.run
|
32
|
+
expect(plugin[:cpu][:real]).to eq(real_cpu)
|
32
33
|
end
|
33
34
|
|
34
35
|
it "has a cpu 0" do
|
35
|
-
|
36
|
-
expect(
|
36
|
+
plugin.run
|
37
|
+
expect(plugin[:cpu]).to have_key("0")
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -41,133 +42,281 @@ end
|
|
41
42
|
shared_examples "S390 processor info" do |cpu_no, version, identification, machine|
|
42
43
|
describe "S390 processor" do
|
43
44
|
it "has a version for cpu #{cpu_no}" do
|
44
|
-
|
45
|
-
expect(
|
46
|
-
expect(
|
45
|
+
plugin.run
|
46
|
+
expect(plugin[:cpu]["#{cpu_no}"]).to have_key("version")
|
47
|
+
expect(plugin[:cpu]["#{cpu_no}"]["version"]).to eql(version)
|
47
48
|
end
|
48
49
|
|
49
50
|
it "has a identification for cpu #{cpu_no}" do
|
50
|
-
|
51
|
-
expect(
|
52
|
-
expect(
|
51
|
+
plugin.run
|
52
|
+
expect(plugin[:cpu]["#{cpu_no}"]).to have_key("identification")
|
53
|
+
expect(plugin[:cpu]["#{cpu_no}"]["identification"]).to eql(identification)
|
53
54
|
end
|
54
55
|
|
55
56
|
it "has a machine for cpu #{cpu_no}" do
|
56
|
-
|
57
|
-
expect(
|
58
|
-
expect(
|
57
|
+
plugin.run
|
58
|
+
expect(plugin[:cpu]["#{cpu_no}"]).to have_key("machine")
|
59
|
+
expect(plugin[:cpu]["#{cpu_no}"]["machine"]).to eql(machine)
|
59
60
|
end
|
60
61
|
end
|
61
|
-
end
|
62
|
+
end
|
62
63
|
|
63
64
|
describe Ohai::System, "General Linux cpu plugin" do
|
65
|
+
let(:plugin) { get_plugin("linux/cpu") }
|
66
|
+
|
67
|
+
let(:cpuinfo_contents) do
|
68
|
+
<<-EOF
|
69
|
+
processor : 0
|
70
|
+
vendor_id : GenuineIntel
|
71
|
+
cpu family : 6
|
72
|
+
model : 23
|
73
|
+
model name : Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
|
74
|
+
stepping : 6
|
75
|
+
cpu MHz : 1968.770
|
76
|
+
cache size : 64 KB
|
77
|
+
fdiv_bug : no
|
78
|
+
hlt_bug : no
|
79
|
+
f00f_bug : no
|
80
|
+
coma_bug : no
|
81
|
+
fpu : yes
|
82
|
+
fpu_exception : yes
|
83
|
+
cpuid level : 10
|
84
|
+
wp : yes
|
85
|
+
flags : fpu pse tsc msr mce cx8 sep mtrr pge cmov
|
86
|
+
bogomips : 2575.86
|
87
|
+
clflush size : 32
|
88
|
+
EOF
|
89
|
+
end
|
90
|
+
|
91
|
+
let(:tempfile_handle) do
|
92
|
+
tempfile = Tempfile.new('ohai-rspec-proc-cpuinfo')
|
93
|
+
tempfile.write cpuinfo_contents
|
94
|
+
tempfile.rewind
|
95
|
+
tempfile
|
96
|
+
end
|
97
|
+
|
64
98
|
before(:each) do
|
65
|
-
|
66
|
-
allow(
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
and_yield("cache size : 64 KB").
|
77
|
-
and_yield("fdiv_bug : no").
|
78
|
-
and_yield("hlt_bug : no").
|
79
|
-
and_yield("f00f_bug : no").
|
80
|
-
and_yield("coma_bug : no").
|
81
|
-
and_yield("fpu : yes").
|
82
|
-
and_yield("fpu_exception : yes").
|
83
|
-
and_yield("cpuid level : 10").
|
84
|
-
and_yield("wp : yes").
|
85
|
-
and_yield("flags : fpu pse tsc msr mce cx8 sep mtrr pge cmov").
|
86
|
-
and_yield("bogomips : 2575.86").
|
87
|
-
and_yield("clflush size : 32")
|
88
|
-
allow(File).to receive(:open).with("/proc/cpuinfo").and_return(@double_file)
|
99
|
+
allow(plugin).to receive(:collect_os).and_return(:linux)
|
100
|
+
allow(File).to receive(:open).with("/proc/cpuinfo").and_return(tempfile_handle)
|
101
|
+
end
|
102
|
+
|
103
|
+
after(:each) do
|
104
|
+
begin
|
105
|
+
tempfile.close
|
106
|
+
tempfile.unlink
|
107
|
+
rescue
|
108
|
+
# really do not care
|
109
|
+
end
|
89
110
|
end
|
90
|
-
|
111
|
+
|
91
112
|
it_behaves_like "Common cpu info", 1, 0
|
92
|
-
|
113
|
+
|
93
114
|
it "gets total cores" do
|
94
|
-
|
95
|
-
expect(
|
115
|
+
plugin.run
|
116
|
+
expect(plugin[:cpu][:cores]).to eql(0)
|
96
117
|
end
|
97
118
|
|
98
119
|
it "doesn't have a cpu 1" do
|
99
|
-
|
100
|
-
expect(
|
120
|
+
plugin.run
|
121
|
+
expect(plugin[:cpu]).not_to have_key("1")
|
101
122
|
end
|
102
123
|
|
103
124
|
it "has a vendor_id for cpu 0" do
|
104
|
-
|
105
|
-
expect(
|
106
|
-
expect(
|
125
|
+
plugin.run
|
126
|
+
expect(plugin[:cpu]["0"]).to have_key("vendor_id")
|
127
|
+
expect(plugin[:cpu]["0"]["vendor_id"]).to eql("GenuineIntel")
|
107
128
|
end
|
108
129
|
|
109
130
|
it "has a family for cpu 0" do
|
110
|
-
|
111
|
-
expect(
|
112
|
-
expect(
|
131
|
+
plugin.run
|
132
|
+
expect(plugin[:cpu]["0"]).to have_key("family")
|
133
|
+
expect(plugin[:cpu]["0"]["family"]).to eql("6")
|
113
134
|
end
|
114
135
|
|
115
136
|
it "has a model for cpu 0" do
|
116
|
-
|
117
|
-
expect(
|
118
|
-
expect(
|
137
|
+
plugin.run
|
138
|
+
expect(plugin[:cpu]["0"]).to have_key("model")
|
139
|
+
expect(plugin[:cpu]["0"]["model"]).to eql("23")
|
119
140
|
end
|
120
141
|
|
121
142
|
it "has a stepping for cpu 0" do
|
122
|
-
|
123
|
-
expect(
|
124
|
-
expect(
|
143
|
+
plugin.run
|
144
|
+
expect(plugin[:cpu]["0"]).to have_key("stepping")
|
145
|
+
expect(plugin[:cpu]["0"]["stepping"]).to eql("6")
|
125
146
|
end
|
126
147
|
|
127
148
|
it "doesn't have a phyiscal_id for cpu 0" do
|
128
|
-
|
129
|
-
expect(
|
149
|
+
plugin.run
|
150
|
+
expect(plugin[:cpu]["0"]).not_to have_key("physical_id")
|
130
151
|
end
|
131
152
|
|
132
153
|
it "doesn't have a core_id for cpu 0" do
|
133
|
-
|
134
|
-
expect(
|
154
|
+
plugin.run
|
155
|
+
expect(plugin[:cpu]["0"]).not_to have_key("core_id")
|
135
156
|
end
|
136
157
|
|
137
158
|
it "doesn't have a cores for cpu 0" do
|
138
|
-
|
139
|
-
expect(
|
159
|
+
plugin.run
|
160
|
+
expect(plugin[:cpu]["0"]).not_to have_key("cores")
|
140
161
|
end
|
141
162
|
|
142
163
|
it "has a model name for cpu 0" do
|
143
|
-
|
144
|
-
expect(
|
145
|
-
expect(
|
164
|
+
plugin.run
|
165
|
+
expect(plugin[:cpu]["0"]).to have_key("model_name")
|
166
|
+
expect(plugin[:cpu]["0"]["model_name"]).to eql("Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz")
|
146
167
|
end
|
147
168
|
|
148
169
|
it "has a mhz for cpu 0" do
|
149
|
-
|
150
|
-
expect(
|
151
|
-
expect(
|
170
|
+
plugin.run
|
171
|
+
expect(plugin[:cpu]["0"]).to have_key("mhz")
|
172
|
+
expect(plugin[:cpu]["0"]["mhz"]).to eql("1968.770")
|
152
173
|
end
|
153
174
|
|
154
175
|
it "has a cache_size for cpu 0" do
|
155
|
-
|
156
|
-
expect(
|
157
|
-
expect(
|
176
|
+
plugin.run
|
177
|
+
expect(plugin[:cpu]["0"]).to have_key("cache_size")
|
178
|
+
expect(plugin[:cpu]["0"]["cache_size"]).to eql("64 KB")
|
158
179
|
end
|
159
180
|
|
160
181
|
it "has flags for cpu 0" do
|
161
|
-
|
162
|
-
expect(
|
163
|
-
expect(
|
182
|
+
plugin.run
|
183
|
+
expect(plugin[:cpu]["0"]).to have_key("flags")
|
184
|
+
expect(plugin[:cpu]["0"]["flags"]).to eq(%w{fpu pse tsc msr mce cx8 sep mtrr pge cmov})
|
185
|
+
end
|
186
|
+
|
187
|
+
context "with a dual-core hyperthreaded /proc/cpuinfo" do
|
188
|
+
let(:cpuinfo_contents) do
|
189
|
+
<<-EOF
|
190
|
+
processor : 0
|
191
|
+
vendor_id : GenuineIntel
|
192
|
+
cpu family : 6
|
193
|
+
model : 69
|
194
|
+
model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
|
195
|
+
stepping : 1
|
196
|
+
microcode : 0x17
|
197
|
+
cpu MHz : 774.000
|
198
|
+
cache size : 4096 KB
|
199
|
+
physical id : 0
|
200
|
+
siblings : 4
|
201
|
+
core id : 0
|
202
|
+
cpu cores : 2
|
203
|
+
apicid : 0
|
204
|
+
initial apicid : 0
|
205
|
+
fpu : yes
|
206
|
+
fpu_exception : yes
|
207
|
+
cpuid level : 13
|
208
|
+
wp : yes
|
209
|
+
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
|
210
|
+
bogomips : 3591.40
|
211
|
+
clflush size : 64
|
212
|
+
cache_alignment : 64
|
213
|
+
address sizes : 39 bits physical, 48 bits virtual
|
214
|
+
power management:
|
215
|
+
|
216
|
+
processor : 1
|
217
|
+
vendor_id : GenuineIntel
|
218
|
+
cpu family : 6
|
219
|
+
model : 69
|
220
|
+
model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
|
221
|
+
stepping : 1
|
222
|
+
microcode : 0x17
|
223
|
+
cpu MHz : 1600.000
|
224
|
+
cache size : 4096 KB
|
225
|
+
physical id : 0
|
226
|
+
siblings : 4
|
227
|
+
core id : 0
|
228
|
+
cpu cores : 2
|
229
|
+
apicid : 1
|
230
|
+
initial apicid : 1
|
231
|
+
fpu : yes
|
232
|
+
fpu_exception : yes
|
233
|
+
cpuid level : 13
|
234
|
+
wp : yes
|
235
|
+
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
|
236
|
+
bogomips : 3591.40
|
237
|
+
clflush size : 64
|
238
|
+
cache_alignment : 64
|
239
|
+
address sizes : 39 bits physical, 48 bits virtual
|
240
|
+
power management:
|
241
|
+
|
242
|
+
processor : 2
|
243
|
+
vendor_id : GenuineIntel
|
244
|
+
cpu family : 6
|
245
|
+
model : 69
|
246
|
+
model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
|
247
|
+
stepping : 1
|
248
|
+
microcode : 0x17
|
249
|
+
cpu MHz : 800.000
|
250
|
+
cache size : 4096 KB
|
251
|
+
physical id : 0
|
252
|
+
siblings : 4
|
253
|
+
core id : 1
|
254
|
+
cpu cores : 2
|
255
|
+
apicid : 2
|
256
|
+
initial apicid : 2
|
257
|
+
fpu : yes
|
258
|
+
fpu_exception : yes
|
259
|
+
cpuid level : 13
|
260
|
+
wp : yes
|
261
|
+
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
|
262
|
+
bogomips : 3591.40
|
263
|
+
clflush size : 64
|
264
|
+
cache_alignment : 64
|
265
|
+
address sizes : 39 bits physical, 48 bits virtual
|
266
|
+
power management:
|
267
|
+
|
268
|
+
processor : 3
|
269
|
+
vendor_id : GenuineIntel
|
270
|
+
cpu family : 6
|
271
|
+
model : 69
|
272
|
+
model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
|
273
|
+
stepping : 1
|
274
|
+
microcode : 0x17
|
275
|
+
cpu MHz : 774.000
|
276
|
+
cache size : 4096 KB
|
277
|
+
physical id : 0
|
278
|
+
siblings : 4
|
279
|
+
core id : 1
|
280
|
+
cpu cores : 2
|
281
|
+
apicid : 3
|
282
|
+
initial apicid : 3
|
283
|
+
fpu : yes
|
284
|
+
fpu_exception : yes
|
285
|
+
cpuid level : 13
|
286
|
+
wp : yes
|
287
|
+
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
|
288
|
+
bogomips : 3591.40
|
289
|
+
clflush size : 64
|
290
|
+
cache_alignment : 64
|
291
|
+
address sizes : 39 bits physical, 48 bits virtual
|
292
|
+
power management:
|
293
|
+
|
294
|
+
EOF
|
295
|
+
end
|
296
|
+
|
297
|
+
it "has 1 physical socket" do
|
298
|
+
plugin.run
|
299
|
+
expect(plugin[:cpu][:real]).to eq(1)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "has 2 physical cores" do
|
303
|
+
plugin.run
|
304
|
+
expect(plugin[:cpu][:cores]).to eq(2)
|
305
|
+
end
|
306
|
+
|
307
|
+
it "has 4 logical, hyper-threaded cores" do
|
308
|
+
plugin.run
|
309
|
+
expect(plugin[:cpu][:total]).to eq(4)
|
310
|
+
end
|
164
311
|
end
|
165
312
|
end
|
166
313
|
|
167
314
|
describe Ohai::System, "S390 linux cpu plugin" do
|
315
|
+
let(:plugin) { get_plugin("linux/cpu") }
|
316
|
+
|
168
317
|
before(:each) do
|
169
|
-
|
170
|
-
|
318
|
+
allow(plugin).to receive(:collect_os).and_return(:linux)
|
319
|
+
|
171
320
|
@double_file = double("/proc/cpuinfo")
|
172
321
|
allow(@double_file).to receive(:each).
|
173
322
|
and_yield("vendor_id : IBM/S390").
|
@@ -180,28 +329,28 @@ describe Ohai::System, "S390 linux cpu plugin" do
|
|
180
329
|
end
|
181
330
|
|
182
331
|
it_behaves_like "Common cpu info", 2, 0
|
183
|
-
|
332
|
+
|
184
333
|
it "has a cpu 1" do
|
185
|
-
|
186
|
-
expect(
|
334
|
+
plugin.run
|
335
|
+
expect(plugin[:cpu]).to have_key("1")
|
187
336
|
end
|
188
337
|
|
189
338
|
it "has a vendor_id" do
|
190
|
-
|
191
|
-
expect(
|
192
|
-
expect(
|
339
|
+
plugin.run
|
340
|
+
expect(plugin[:cpu]).to have_key("vendor_id")
|
341
|
+
expect(plugin[:cpu]["vendor_id"]).to eql("IBM/S390")
|
193
342
|
end
|
194
343
|
|
195
344
|
it "has a bogomips per cpu" do
|
196
|
-
|
197
|
-
expect(
|
198
|
-
expect(
|
345
|
+
plugin.run
|
346
|
+
expect(plugin[:cpu]).to have_key("bogomips_per_cpu")
|
347
|
+
expect(plugin[:cpu]["bogomips_per_cpu"]).to eql("9328.00")
|
199
348
|
end
|
200
349
|
|
201
350
|
it "has features" do
|
202
|
-
|
203
|
-
expect(
|
204
|
-
expect(
|
351
|
+
plugin.run
|
352
|
+
expect(plugin[:cpu]).to have_key("features")
|
353
|
+
expect(plugin[:cpu]["features"]).to eq(%w{esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs})
|
205
354
|
end
|
206
355
|
|
207
356
|
it_behaves_like "S390 processor info", 0, "EE", "06E276", "2717"
|
@@ -16,47 +16,63 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
require 'spec_helper'
|
18
18
|
|
19
|
-
describe Ohai::System,
|
20
|
-
|
21
|
-
let(:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
allow(
|
30
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
31
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
32
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
33
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
34
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
35
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
36
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
37
|
-
allow(plugin).to receive(:shell_out).with("#{path} stat
|
38
|
-
allow(plugin).to receive(:shell_out).with("#{path}
|
39
|
-
allow(plugin).to receive(:shell_out).with("#{path}
|
19
|
+
describe Ohai::System, 'plugin vmware' do
|
20
|
+
let(:plugin) { get_plugin('vmware') }
|
21
|
+
let(:path) { '/usr/bin/vmware-toolbox-cmd' }
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
allow(plugin).to receive(:collect_os).and_return(:linux)
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'on vmware guest with toolbox installed' do
|
28
|
+
before(:each) do
|
29
|
+
allow(File).to receive(:exist?).with('/usr/bin/vmware-toolbox-cmd').and_return(true)
|
30
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0, '2000 MHz', nil))
|
31
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0, '04 Jun 2015 19:21:16', nil))
|
32
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat sessionid").and_return(mock_shell_out(0, '0x0000000000000000', nil))
|
33
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat balloon").and_return(mock_shell_out(0, '0 MB', nil))
|
34
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat swap").and_return(mock_shell_out(0, '0 MB', nil))
|
35
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat memlimit").and_return(mock_shell_out(0, '4000000000 MB', nil))
|
36
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat memres").and_return(mock_shell_out(0, '0 MB', nil))
|
37
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat cpures").and_return(mock_shell_out(0, '0 MHz', nil))
|
38
|
+
allow(plugin).to receive(:shell_out).with("#{path} stat cpulimit").and_return(mock_shell_out(0, '4000000000 MB', nil))
|
39
|
+
allow(plugin).to receive(:shell_out).with("#{path} upgrade status").and_return(mock_shell_out(0, 'VMware Tools are up-to-date.', nil))
|
40
|
+
allow(plugin).to receive(:shell_out).with("#{path} timesync status").and_return(mock_shell_out(0, 'Disabled', nil))
|
41
|
+
plugin[:virtualization] = Mash.new
|
42
|
+
plugin[:virtualization][:systems] = Mash.new
|
43
|
+
plugin[:virtualization][:systems][:vmware] = Mash.new
|
40
44
|
plugin.run
|
41
45
|
end
|
42
46
|
|
43
|
-
|
44
|
-
|
47
|
+
it 'gets the speed' do
|
48
|
+
expect(plugin[:vmware][:speed]).to eq('2000 MHz')
|
45
49
|
end
|
46
50
|
|
47
|
-
|
51
|
+
it 'gets the hosttime' do
|
52
|
+
expect(plugin[:vmware][:hosttime]).to eq('04 Jun 2015 19:21:16')
|
53
|
+
end
|
48
54
|
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
it 'gets tools update status' do
|
56
|
+
expect(plugin[:vmware][:upgrade]).to eq('VMware Tools are up-to-date.')
|
57
|
+
end
|
58
|
+
end
|
52
59
|
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
context 'on vmware guest without toolbox' do
|
61
|
+
it 'should not create a vmware attribute' do
|
62
|
+
plugin[:virtualization] = Mash.new
|
63
|
+
plugin[:virtualization][:systems] = Mash.new
|
64
|
+
plugin[:virtualization][:systems][:vmware] = Mash.new
|
65
|
+
allow(File).to receive(:exist?).with('/usr/bin/vmware-toolbox-cmd').and_return(false)
|
66
|
+
expect(plugin).not_to have_key(:vmware)
|
67
|
+
end
|
68
|
+
end
|
56
69
|
|
57
|
-
|
58
|
-
|
59
|
-
|
70
|
+
context 'on vbox guest' do
|
71
|
+
it 'should not create a vmware attribute' do
|
72
|
+
plugin[:virtualization] = Mash.new
|
73
|
+
plugin[:virtualization][:systems] = Mash.new
|
74
|
+
plugin[:virtualization][:systems][:vbox] = Mash.new
|
75
|
+
expect(plugin).not_to have_key(:vmware)
|
60
76
|
end
|
61
77
|
end
|
62
78
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.8.
|
4
|
+
version: 8.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: mime-types
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: systemu
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|