ohai 14.15.0 → 15.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/ohai/application.rb +0 -4
- data/lib/ohai/common/dmi.rb +43 -43
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/loader.rb +32 -47
- data/lib/ohai/mixin/dmi_decode.rb +29 -32
- data/lib/ohai/mixin/os.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +5 -5
- data/lib/ohai/plugins/aix/virtualization.rb +4 -4
- data/lib/ohai/plugins/bsd/virtualization.rb +10 -12
- data/lib/ohai/plugins/c.rb +0 -20
- data/lib/ohai/plugins/elixir.rb +13 -13
- data/lib/ohai/plugins/filesystem.rb +10 -10
- data/lib/ohai/plugins/gce.rb +42 -8
- data/lib/ohai/plugins/go.rb +11 -11
- data/lib/ohai/plugins/groovy.rb +12 -12
- data/lib/ohai/plugins/hostname.rb +9 -2
- data/lib/ohai/plugins/linux/fips.rb +2 -9
- data/lib/ohai/plugins/linux/memory.rb +5 -0
- data/lib/ohai/plugins/linux/network.rb +1 -1
- data/lib/ohai/plugins/linux/platform.rb +84 -83
- data/lib/ohai/plugins/linux/systemd_paths.rb +0 -3
- data/lib/ohai/plugins/linux/virtualization.rb +10 -20
- data/lib/ohai/plugins/lua.rb +13 -13
- data/lib/ohai/plugins/mono.rb +23 -23
- data/lib/ohai/plugins/nodejs.rb +13 -13
- data/lib/ohai/plugins/openstack.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -28
- data/lib/ohai/plugins/perl.rb +17 -17
- data/lib/ohai/plugins/php.rb +22 -22
- data/lib/ohai/plugins/powershell.rb +30 -30
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +15 -15
- data/lib/ohai/plugins/rust.rb +11 -11
- data/lib/ohai/plugins/solaris2/dmi.rb +48 -48
- data/lib/ohai/plugins/solaris2/virtualization.rb +8 -10
- data/lib/ohai/plugins/virtualbox.rb +21 -21
- data/lib/ohai/plugins/windows/filesystem.rb +2 -2
- data/lib/ohai/plugins/windows/fips.rb +2 -21
- data/lib/ohai/plugins/windows/virtualization.rb +9 -35
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +0 -17
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +2 -2
- data/spec/data/plugins/rpmquery.output +0 -2
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +2 -2
- data/spec/functional/plugins/powershell_spec.rb +2 -2
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +2 -2
- data/spec/ohai_spec.rb +1 -1
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +1 -1
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +12 -12
- data/spec/unit/mixin/azure_metadata_spec.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +1 -1
- data/spec/unit/mixin/dmi_decode.rb +68 -0
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/abort_spec.rb +9 -9
- data/spec/unit/plugins/aix/cpu_spec.rb +4 -4
- data/spec/unit/plugins/aix/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +1 -1
- data/spec/unit/plugins/aix/network_spec.rb +6 -6
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +4 -4
- data/spec/unit/plugins/bsd/virtualization_spec.rb +3 -3
- data/spec/unit/plugins/c_spec.rb +1 -53
- data/spec/unit/plugins/chef_spec.rb +1 -1
- data/spec/unit/plugins/cloud_spec.rb +1 -1
- data/spec/unit/plugins/darwin/cpu_spec.rb +2 -2
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +3 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
- data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
- data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/docker_spec.rb +1 -1
- data/spec/unit/plugins/ec2_spec.rb +1 -1
- data/spec/unit/plugins/elixir_spec.rb +1 -1
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
- data/spec/unit/plugins/fail_spec.rb +28 -28
- data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +1 -1
- data/spec/unit/plugins/hostname_spec.rb +68 -1
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +1 -1
- data/spec/unit/plugins/joyent_spec.rb +3 -3
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linode_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +6 -6
- data/spec/unit/plugins/linux/filesystem_spec.rb +21 -21
- data/spec/unit/plugins/linux/fips_spec.rb +13 -45
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +8 -8
- data/spec/unit/plugins/linux/lsb_spec.rb +3 -3
- data/spec/unit/plugins/linux/lspci_spec.rb +2 -2
- data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +2 -2
- data/spec/unit/plugins/linux/memory_spec.rb +26 -1
- data/spec/unit/plugins/linux/network_spec.rb +37 -37
- data/spec/unit/plugins/linux/platform_spec.rb +580 -837
- data/spec/unit/plugins/linux/sessions_spec.rb +2 -2
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +1 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +28 -227
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +11 -11
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/openstack_spec.rb +8 -4
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +1 -21
- data/spec/unit/plugins/passwd_spec.rb +1 -1
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +6 -6
- data/spec/unit/plugins/platform_spec.rb +1 -1
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +2 -2
- data/spec/unit/plugins/root_group_spec.rb +1 -11
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/rust_spec.rb +1 -1
- data/spec/unit/plugins/scala_spec.rb +1 -1
- data/spec/unit/plugins/scsi_spec.rb +2 -2
- data/spec/unit/plugins/shard_spec.rb +1 -1
- data/spec/unit/plugins/shells_spec.rb +1 -1
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +4 -4
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +6 -6
- data/spec/unit/plugins/solaris2/platform_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +41 -69
- data/spec/unit/plugins/ssh_host_keys_spec.rb +3 -3
- data/spec/unit/plugins/sysconf_spec.rb +2 -2
- data/spec/unit/plugins/timezone_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/vmware_spec.rb +1 -1
- data/spec/unit/plugins/windows/cpu_spec.rb +1 -2
- data/spec/unit/plugins/windows/filesystem_spec.rb +2 -2
- data/spec/unit/plugins/windows/fips_spec.rb +17 -77
- data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +2 -2
- data/spec/unit/plugins/windows/network_spec.rb +1 -1
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +1 -1
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +20 -238
- data/spec/unit/plugins/zpools_spec.rb +7 -7
- data/spec/unit/provides_map_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +1 -1
- data/spec/unit/system_spec.rb +10 -77
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +1 -1
- metadata +6 -9
- data/lib/ohai/plugins/darwin/system_profiler.rb +0 -72
- data/lib/ohai/util/win32/group_helper.rb +0 -76
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -79524
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +0 -40
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux sessions plugin" do
|
22
22
|
let(:plugin) { get_plugin("linux/sessions") }
|
@@ -31,7 +31,7 @@ describe Ohai::System, "Linux sessions plugin" do
|
|
31
31
|
318 0 root
|
32
32
|
46 0 root
|
33
33
|
306 1000 joe
|
34
|
-
LOGINCTL_OUT
|
34
|
+
LOGINCTL_OUT
|
35
35
|
allow(plugin).to receive(:which).with("loginctl").and_return("/bin/loginctl")
|
36
36
|
allow(plugin).to receive(:shell_out).with("/bin/loginctl --no-pager --no-legend --no-ask-password list-sessions").and_return(mock_shell_out(0, loginctl_out, ""))
|
37
37
|
plugin.run
|
@@ -66,7 +66,7 @@ describe Ohai::System, "Linux systemd paths plugin" do
|
|
66
66
|
search-configuration-factory: /usr/local/share/factory/etc:/usr/share/factory/etc
|
67
67
|
search-state-factory: /usr/local/share/factory/var:/usr/share/factory/var
|
68
68
|
search-configuration: /home/foo/.config:/etc
|
69
|
-
SYSTEMD_PATH_OUT
|
69
|
+
SYSTEMD_PATH_OUT
|
70
70
|
|
71
71
|
allow(plugin).to receive(:which).with("systemd-path").and_return("/bin/systemd-path")
|
72
72
|
allow(plugin).to receive(:shell_out).with("/bin/systemd-path").and_return(mock_shell_out(0, systemd_path_out, ""))
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Linux virtualization platform" do
|
22
22
|
let(:plugin) { get_plugin("linux/virtualization") }
|
@@ -29,7 +29,6 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
29
29
|
allow(File).to receive(:exist?).with("/proc/xen/capabilities").and_return(false)
|
30
30
|
allow(File).to receive(:exist?).with("/proc/modules").and_return(false)
|
31
31
|
allow(File).to receive(:exist?).with("/proc/cpuinfo").and_return(false)
|
32
|
-
allow(File).to receive(:exist?).with("/usr/sbin/dmidecode").and_return(false)
|
33
32
|
allow(File).to receive(:exist?).with("/var/lib/hyperv/.kvp_pool_3").and_return(false)
|
34
33
|
allow(File).to receive(:exist?).with("/proc/self/status").and_return(false)
|
35
34
|
allow(File).to receive(:exist?).with("/proc/bc/0").and_return(false)
|
@@ -37,7 +36,6 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
37
36
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(false)
|
38
37
|
allow(File).to receive(:exist?).with("/.dockerenv").and_return(false)
|
39
38
|
allow(File).to receive(:exist?).with("/.dockerinit").and_return(false)
|
40
|
-
allow(File).to receive(:exist?).with("/proc/bus/pci/devices").and_return(false)
|
41
39
|
allow(File).to receive(:exist?).with("/sys/devices/virtual/misc/kvm").and_return(false)
|
42
40
|
allow(File).to receive(:exist?).with("/dev/lxd/sock").and_return(false)
|
43
41
|
allow(File).to receive(:exist?).with("/var/lib/lxd/devlxd").and_return(false)
|
@@ -187,199 +185,28 @@ describe Ohai::System, "Linux virtualization platform" do
|
|
187
185
|
end
|
188
186
|
end
|
189
187
|
|
190
|
-
describe "when we are parsing
|
191
|
-
before(:each) do
|
192
|
-
expect(File).to receive(:exist?).with("/usr/sbin/dmidecode").and_return(true)
|
193
|
-
end
|
194
|
-
|
195
|
-
it "sets virtualpc guest if dmidecode detects Microsoft Virtual Machine" do
|
196
|
-
ms_vpc_dmidecode = <<~MSVPC
|
197
|
-
System Information
|
198
|
-
Manufacturer: Microsoft Corporation
|
199
|
-
Product Name: Virtual Machine
|
200
|
-
Version: VS2005R2
|
201
|
-
Serial Number: 1688-7189-5337-7903-2297-1012-52
|
202
|
-
UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
|
203
|
-
Wake-up Type: Power Switch
|
204
|
-
MSVPC
|
205
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vpc_dmidecode, ""))
|
206
|
-
plugin.run
|
207
|
-
expect(plugin[:virtualization][:system]).to eq("virtualpc")
|
208
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
209
|
-
expect(plugin[:virtualization][:systems][:virtualpc]).to eq("guest")
|
210
|
-
end
|
211
|
-
|
212
|
-
it "sets hyperv guest if dmidecode detects Hyper-V or version 7.0" do
|
213
|
-
ms_hv_dmidecode = <<~MSHV
|
214
|
-
System Information
|
215
|
-
Manufacturer: Microsoft Corporation
|
216
|
-
Product Name: Virtual Machine
|
217
|
-
Version: 7.0
|
218
|
-
Serial Number: 9242-2608-7031-8934-2088-5216-61
|
219
|
-
UUID: C2431A2D-D69C-244F-9DE8-CD5D09E0DA39
|
220
|
-
Wake-up Type: Power Switch
|
221
|
-
MSHV
|
222
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_hv_dmidecode, ""))
|
223
|
-
plugin.run
|
224
|
-
expect(plugin[:virtualization][:system]).to eq("hyperv")
|
225
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
226
|
-
expect(plugin[:virtualization][:systems][:hyperv]).to eq("guest")
|
227
|
-
end
|
228
|
-
|
229
|
-
it "sets virtualserver guest if dmidecode detects version 5.0" do
|
230
|
-
ms_vs_dmidecode = <<~MSVS
|
231
|
-
System Information
|
232
|
-
Manufacturer: Microsoft Corporation
|
233
|
-
Product Name: Virtual Machine
|
234
|
-
Version: 5.0
|
235
|
-
Serial Number: 1688-7189-5337-7903-2297-1012-52
|
236
|
-
UUID: D29974A4-BE51-044C-BDC6-EFBC4B87A8E9
|
237
|
-
Wake-up Type: Power Switch
|
238
|
-
MSVS
|
239
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, ms_vs_dmidecode, ""))
|
240
|
-
plugin.run
|
241
|
-
expect(plugin[:virtualization][:system]).to eq("virtualserver")
|
242
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
243
|
-
expect(plugin[:virtualization][:systems][:virtualserver]).to eq("guest")
|
244
|
-
end
|
245
|
-
|
246
|
-
it "sets vmware guest if dmidecode detects VMware" do
|
247
|
-
vmware_dmidecode = <<~VMWARE
|
248
|
-
System Information
|
249
|
-
Manufacturer: VMware, Inc.
|
250
|
-
Product Name: VMware Virtual Platform
|
251
|
-
Version: None
|
252
|
-
Serial Number: VMware-50 3f f7 14 42 d1 f1 da-3b 46 27 d0 29 b4 74 1d
|
253
|
-
UUID: a86cc405-e1b9-447b-ad05-6f8db39d876a
|
254
|
-
Wake-up Type: Power Switch
|
255
|
-
SKU Number: Not Specified
|
256
|
-
Family: Not Specified
|
257
|
-
VMWARE
|
258
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, vmware_dmidecode, ""))
|
259
|
-
plugin.run
|
260
|
-
expect(plugin[:virtualization][:system]).to eq("vmware")
|
261
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
262
|
-
expect(plugin[:virtualization][:systems][:vmware]).to eq("guest")
|
263
|
-
end
|
264
|
-
|
265
|
-
it "sets vbox guest if dmidecode detects VirtualBox" do
|
266
|
-
vbox_dmidecode = <<~VBOX
|
267
|
-
Base Board Information
|
268
|
-
Manufacturer: Oracle Corporation
|
269
|
-
Product Name: VirtualBox
|
270
|
-
Version: 1.2
|
271
|
-
Serial Number: 0
|
272
|
-
Asset Tag: Not Specified
|
273
|
-
Features:
|
274
|
-
Board is a hosting board
|
275
|
-
Location In Chasis: Not Specified
|
276
|
-
Type: Motherboard
|
277
|
-
Contained Object Handles: 0
|
278
|
-
VBOX
|
279
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, vbox_dmidecode, ""))
|
280
|
-
plugin.run
|
281
|
-
expect(plugin[:virtualization][:system]).to eq("vbox")
|
282
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
283
|
-
expect(plugin[:virtualization][:systems][:vbox]).to eq("guest")
|
284
|
-
end
|
285
|
-
|
286
|
-
it "sets openstack guest if dmidecode detects OpenStack" do
|
287
|
-
openstack_dmidecode = <<~OPENSTACK
|
288
|
-
System Information
|
289
|
-
Manufacturer: Red Hat Inc.
|
290
|
-
Product Name: OpenStack Nova
|
291
|
-
Version: 2014.1.2-1.el6
|
292
|
-
Serial Number: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
293
|
-
UUID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
294
|
-
Wake-up Type: Power Switch
|
295
|
-
SKU Number: Not Specified
|
296
|
-
Family: Red Hat Enterprise Linux
|
297
|
-
OPENSTACK
|
298
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, openstack_dmidecode, ""))
|
299
|
-
plugin.run
|
300
|
-
expect(plugin[:virtualization][:system]).to eq("openstack")
|
301
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
302
|
-
expect(plugin[:virtualization][:systems][:openstack]).to eq("guest")
|
303
|
-
end
|
304
|
-
|
305
|
-
it "sets kvm guest if dmidecode contains KVM" do
|
306
|
-
kvm_dmidecode = <<~RKVM
|
307
|
-
System Information
|
308
|
-
Manufacturer: Red Hat
|
309
|
-
Product Name: KVM
|
310
|
-
Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
|
311
|
-
Serial Number: Not Specified
|
312
|
-
UUID: 6E56CFE2-2088-4A46-906A-FC49EDC4072C
|
313
|
-
Wake-up Type: Power Switch
|
314
|
-
SKU Number: Not Specified
|
315
|
-
Family: Red Hat Enterprise Linux
|
316
|
-
RKVM
|
317
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, kvm_dmidecode, ""))
|
318
|
-
plugin.run
|
319
|
-
expect(plugin[:virtualization][:system]).to eq("kvm")
|
320
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
321
|
-
expect(plugin[:virtualization][:systems][:kvm]).to eq("guest")
|
322
|
-
end
|
188
|
+
describe "when we are parsing DMI data" do
|
323
189
|
|
324
|
-
it "sets
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
UUID: E7F1DC93-3DA1-4EC3-A6AB-F6904BA87985
|
332
|
-
Wake-up Type: Power Switch
|
333
|
-
SKU Number: Not Specified
|
334
|
-
Family: Red Hat Enterprise Linux
|
335
|
-
RHEV
|
336
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, kvm_dmidecode, ""))
|
190
|
+
it "sets virtualization attributes if the appropriate DMI data is present" do
|
191
|
+
plugin[:dmi] = { system: {
|
192
|
+
manufacturer: "Amazon EC2",
|
193
|
+
product: "c5n.large",
|
194
|
+
version: nil,
|
195
|
+
},
|
196
|
+
}
|
337
197
|
plugin.run
|
338
|
-
expect(plugin[:virtualization][:system]).to eq("
|
339
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
340
|
-
expect(plugin[:virtualization][:systems][:kvm]).to eq("guest")
|
341
|
-
end
|
342
|
-
|
343
|
-
it "sets bhyve guest if dmidecode detects bhyve" do
|
344
|
-
bhyve_dmidecode = <<~OUTPUT
|
345
|
-
System Information
|
346
|
-
Manufacturer:
|
347
|
-
Product Name: BHYVE
|
348
|
-
Version: 1.0
|
349
|
-
Serial Number: None
|
350
|
-
UUID: 023B323A-E139-4B36-8BC5-CEBB2469DAAA
|
351
|
-
Wake-up Type: Power Switch
|
352
|
-
SKU Number: None
|
353
|
-
Family:
|
354
|
-
OUTPUT
|
355
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, bhyve_dmidecode, ""))
|
356
|
-
plugin.run
|
357
|
-
expect(plugin[:virtualization][:system]).to eq("bhyve")
|
198
|
+
expect(plugin[:virtualization][:system]).to eq("amazonec2")
|
358
199
|
expect(plugin[:virtualization][:role]).to eq("guest")
|
359
|
-
expect(plugin[:virtualization][:systems][:
|
360
|
-
end
|
361
|
-
|
362
|
-
it "sets veertu guest if dmidecode detects Veertu" do
|
363
|
-
veertu_dmidecode = <<~VEERTU
|
364
|
-
System Information
|
365
|
-
Manufacturer: Veertu
|
366
|
-
Product Name: Veertu
|
367
|
-
Version: Not Specified
|
368
|
-
Serial Number: Not Specified
|
369
|
-
UUID: Not Settable
|
370
|
-
Wake-up Type: Power Switch
|
371
|
-
SKU Number: Not Specified
|
372
|
-
Family: Not Specified
|
373
|
-
VEERTU
|
374
|
-
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, veertu_dmidecode, ""))
|
375
|
-
plugin.run
|
376
|
-
expect(plugin[:virtualization][:system]).to eq("veertu")
|
377
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
378
|
-
expect(plugin[:virtualization][:systems][:veertu]).to eq("guest")
|
200
|
+
expect(plugin[:virtualization][:systems][:amazonec2]).to eq("guest")
|
379
201
|
end
|
380
202
|
|
381
|
-
it "
|
382
|
-
|
203
|
+
it "sets empty virtualization attributes if nothing is detected" do
|
204
|
+
plugin[:dmi] = { system: {
|
205
|
+
manufacturer: "Supermicro",
|
206
|
+
product: "X10SLH-N6-ST031",
|
207
|
+
version: "0123456789",
|
208
|
+
},
|
209
|
+
}
|
383
210
|
plugin.run
|
384
211
|
expect(plugin[:virtualization]).to eq({ "systems" => {} })
|
385
212
|
end
|
@@ -485,32 +312,6 @@ VEERTU
|
|
485
312
|
end
|
486
313
|
end
|
487
314
|
|
488
|
-
describe "when we are checking for parallels" do
|
489
|
-
it "sets parallels guest if /proc/bus/pci/devices contains 1ab84000" do
|
490
|
-
devices = <<~DEVICES
|
491
|
-
0018 1ab84000 1f 8001 0 0 0 0 0 0 20 0 0 0 0 0 0 prl_tg
|
492
|
-
0028 1af41000 17 8201 ee000000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
|
493
|
-
DEVICES
|
494
|
-
expect(File).to receive(:exist?).with("/proc/bus/pci/devices").and_return(true)
|
495
|
-
allow(File).to receive(:read).with("/proc/bus/pci/devices").and_return(devices)
|
496
|
-
plugin.run
|
497
|
-
expect(plugin[:virtualization][:system]).to eq("parallels")
|
498
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
499
|
-
expect(plugin[:virtualization][:systems][:parallels]).to eq("guest")
|
500
|
-
end
|
501
|
-
|
502
|
-
it "does not set virtualization if /proc/bus/pci/devices not contains 1ab84000" do
|
503
|
-
devices = <<~DEVICES
|
504
|
-
0030 1af41000 a 8401 ee040000 0 0 0 0 0 40 1000 0 0 0 0 0 virtio-pci
|
505
|
-
0050 10110022 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
506
|
-
DEVICES
|
507
|
-
expect(File).to receive(:exist?).with("/proc/bus/pci/devices").and_return(true)
|
508
|
-
allow(File).to receive(:read).with("/proc/bus/pci/devices").and_return(devices)
|
509
|
-
plugin.run
|
510
|
-
expect(plugin[:virtualization]).to eq({ "systems" => {} })
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
315
|
describe "when we are checking for lxd" do
|
515
316
|
it "sets lxc guest if /dev/lxd/sock exists" do
|
516
317
|
expect(File).to receive(:exist?).with("/dev/lxd/sock").and_return(true)
|
@@ -548,7 +349,7 @@ VEERTU
|
|
548
349
|
3:cpuacct:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
|
549
350
|
2:cpu:/lxc/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
|
550
351
|
1:cpuset:/
|
551
|
-
CGROUP
|
352
|
+
CGROUP
|
552
353
|
expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
553
354
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
554
355
|
plugin.run
|
@@ -567,7 +368,7 @@ CGROUP
|
|
567
368
|
3:cpuacct:/lxc/vanilla
|
568
369
|
2:cpu:/lxc/vanilla
|
569
370
|
1:cpuset:/lxc/vanilla
|
570
|
-
CGROUP
|
371
|
+
CGROUP
|
571
372
|
expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
572
373
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
573
374
|
plugin.run
|
@@ -586,7 +387,7 @@ CGROUP
|
|
586
387
|
3:cpuacct:/Charlie
|
587
388
|
2:cpu:/Charlie
|
588
389
|
1:cpuset:/Charlie
|
589
|
-
CGROUP
|
390
|
+
CGROUP
|
590
391
|
allow(File).to receive(:read).with("/proc/1/environ").and_return("")
|
591
392
|
expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
592
393
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
@@ -605,7 +406,7 @@ CGROUP
|
|
605
406
|
3:cpuacct:/
|
606
407
|
2:cpu:/
|
607
408
|
1:cpuset:/
|
608
|
-
CGROUP
|
409
|
+
CGROUP
|
609
410
|
expect(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
610
411
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
611
412
|
allow(File).to receive(:read).with("/proc/1/environ").and_return("")
|
@@ -684,7 +485,7 @@ CGROUP
|
|
684
485
|
3:cpuacct:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
|
685
486
|
2:cpu:/docker/baa660ed81bc81d262ac6e19486142aeec5fce2043e2a173eb2505c6fbed89bc
|
686
487
|
1:cpuset:/
|
687
|
-
CGROUP
|
488
|
+
CGROUP
|
688
489
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
689
490
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
690
491
|
plugin.run
|
@@ -703,7 +504,7 @@ CGROUP
|
|
703
504
|
3:cpuacct:/docker/vanilla
|
704
505
|
2:cpu:/docker/vanilla
|
705
506
|
1:cpuset:/docker/vanilla
|
706
|
-
CGROUP
|
507
|
+
CGROUP
|
707
508
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
708
509
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
709
510
|
plugin.run
|
@@ -727,7 +528,7 @@ CGROUP
|
|
727
528
|
3:cpuacct:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
728
529
|
2:cpu:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
729
530
|
1:cpuset:/docker-ce/docker/b15b85d19304436488a78d06afeb108d94b20bb6898d852b65cad51bd7dc9468
|
730
|
-
CGROUP
|
531
|
+
CGROUP
|
731
532
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
732
533
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
733
534
|
plugin.run
|
@@ -748,7 +549,7 @@ CGROUP
|
|
748
549
|
3:memory:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
|
749
550
|
2:cpu,cpuacct:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
|
750
551
|
1:name=systemd:/system.slice/docker-47341c91be8d491cb3b8a475ad5b4aef6e79bf728cbb351c384e4a6c410f172f.scope
|
751
|
-
CGROUP
|
552
|
+
CGROUP
|
752
553
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
753
554
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
754
555
|
plugin.run
|
@@ -767,7 +568,7 @@ CGROUP
|
|
767
568
|
3:cpuacct:/Charlie
|
768
569
|
2:cpu:/Charlie
|
769
570
|
1:cpuset:/Charlie
|
770
|
-
CGROUP
|
571
|
+
CGROUP
|
771
572
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
772
573
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
773
574
|
allow(File).to receive(:read).with("/proc/1/environ").and_return("")
|
@@ -786,7 +587,7 @@ CGROUP
|
|
786
587
|
3:cpuacct:/
|
787
588
|
2:cpu:/
|
788
589
|
1:cpuset:/
|
789
|
-
CGROUP
|
590
|
+
CGROUP
|
790
591
|
allow(File).to receive(:exist?).with("/proc/self/cgroup").and_return(true)
|
791
592
|
allow(File).to receive(:read).with("/proc/self/cgroup").and_return(self_cgroup)
|
792
593
|
plugin.run
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "plugin mono" do
|
22
22
|
let(:plugin) { get_plugin("mono") }
|
@@ -34,7 +34,7 @@ describe Ohai::System, "plugin mono" do
|
|
34
34
|
Misc: softdebug
|
35
35
|
LLVM: supported, not enabled.
|
36
36
|
GC: sgen
|
37
|
-
OUT
|
37
|
+
OUT
|
38
38
|
allow(plugin).to receive(:shell_out).with("mono -V").and_return(mock_shell_out(0, @stdout, ""))
|
39
39
|
end
|
40
40
|
|