ohai 8.10.0 → 8.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/Rakefile +13 -4
- data/bin/ohai +3 -4
- data/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +7 -6
- data/lib/ohai/common/dmi.rb +56 -56
- data/lib/ohai/config.rb +12 -8
- data/lib/ohai/dsl.rb +3 -3
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvi.rb +0 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -0
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +7 -7
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mash.rb +3 -2
- data/lib/ohai/mixin/command.rb +25 -23
- data/lib/ohai/mixin/dmi_decode.rb +10 -10
- data/lib/ohai/mixin/ec2_metadata.rb +40 -39
- data/lib/ohai/mixin/gce_metadata.rb +9 -9
- data/lib/ohai/mixin/network_constants.rb +1 -1
- data/lib/ohai/mixin/os.rb +3 -3
- data/lib/ohai/mixin/seconds_to_human.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +10 -10
- data/lib/ohai/mixin/string.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/cpu.rb +2 -2
- data/lib/ohai/plugins/aix/filesystem.rb +2 -2
- data/lib/ohai/plugins/aix/memory.rb +2 -2
- data/lib/ohai/plugins/aix/network.rb +9 -10
- data/lib/ohai/plugins/aix/os.rb +2 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -3
- data/lib/ohai/plugins/aix/virtualization.rb +23 -23
- data/lib/ohai/plugins/azure.rb +32 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +22 -22
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/chef.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +59 -60
- data/lib/ohai/plugins/cloud_v2.rb +37 -39
- data/lib/ohai/plugins/darwin/cpu.rb +1 -1
- data/lib/ohai/plugins/darwin/filesystem2.rb +5 -5
- data/lib/ohai/plugins/darwin/memory.rb +5 -6
- data/lib/ohai/plugins/darwin/network.rb +7 -7
- data/lib/ohai/plugins/darwin/system_profiler.rb +32 -33
- data/lib/ohai/plugins/darwin/virtualization.rb +9 -9
- data/lib/ohai/plugins/digital_ocean.rb +16 -16
- data/lib/ohai/plugins/dmi.rb +6 -6
- data/lib/ohai/plugins/dragonflybsd/cpu.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/memory.rb +0 -1
- data/lib/ohai/plugins/dragonflybsd/network.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/os.rb +1 -1
- data/lib/ohai/plugins/ec2.rb +39 -15
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +3 -3
- data/lib/ohai/plugins/eucalyptus.rb +16 -12
- data/lib/ohai/plugins/freebsd/cpu.rb +2 -2
- data/lib/ohai/plugins/freebsd/memory.rb +0 -1
- data/lib/ohai/plugins/freebsd/network.rb +4 -4
- data/lib/ohai/plugins/freebsd/os.rb +1 -1
- data/lib/ohai/plugins/gce.rb +6 -6
- data/lib/ohai/plugins/hostname.rb +7 -7
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/ip_scopes.rb +9 -9
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/joyent.rb +7 -7
- data/lib/ohai/plugins/kernel.rb +8 -8
- data/lib/ohai/plugins/linode.rb +7 -4
- data/lib/ohai/plugins/linux/cpu.rb +5 -5
- data/lib/ohai/plugins/linux/filesystem.rb +16 -16
- data/lib/ohai/plugins/linux/filesystem2.rb +15 -15
- data/lib/ohai/plugins/linux/mdadm.rb +3 -3
- data/lib/ohai/plugins/linux/network.rb +85 -51
- data/lib/ohai/plugins/linux/platform.rb +24 -24
- data/lib/ohai/plugins/linux/virtualization.rb +8 -8
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/cpu.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +2 -2
- data/lib/ohai/plugins/network.rb +11 -11
- data/lib/ohai/plugins/network_listeners.rb +30 -26
- data/lib/ohai/plugins/ohai.rb +3 -3
- data/lib/ohai/plugins/openbsd/cpu.rb +4 -4
- data/lib/ohai/plugins/openbsd/memory.rb +4 -4
- data/lib/ohai/plugins/openbsd/network.rb +3 -3
- data/lib/ohai/plugins/openstack.rb +12 -12
- data/lib/ohai/plugins/os.rb +2 -2
- data/lib/ohai/plugins/packages.rb +22 -22
- data/lib/ohai/plugins/passwd.rb +4 -4
- data/lib/ohai/plugins/powershell.rb +9 -9
- data/lib/ohai/plugins/ps.rb +2 -2
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +13 -13
- data/lib/ohai/plugins/root_group.rb +4 -4
- data/lib/ohai/plugins/ruby.rb +6 -6
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/sigar/cpu.rb +1 -1
- data/lib/ohai/plugins/sigar/filesystem.rb +1 -1
- data/lib/ohai/plugins/sigar/network.rb +13 -13
- data/lib/ohai/plugins/sigar/network_route.rb +34 -29
- data/lib/ohai/plugins/softlayer.rb +8 -7
- data/lib/ohai/plugins/solaris2/cpu.rb +19 -19
- data/lib/ohai/plugins/solaris2/dmi.rb +63 -63
- data/lib/ohai/plugins/solaris2/filesystem.rb +13 -13
- data/lib/ohai/plugins/solaris2/memory.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +5 -5
- data/lib/ohai/plugins/solaris2/virtualization.rb +18 -18
- data/lib/ohai/plugins/solaris2/zpools.rb +1 -1
- data/lib/ohai/plugins/ssh_host_key.rb +2 -2
- data/lib/ohai/plugins/uptime.rb +4 -5
- data/lib/ohai/plugins/virtualbox.rb +2 -2
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/cpu.rb +14 -14
- data/lib/ohai/plugins/windows/drivers.rb +8 -8
- data/lib/ohai/plugins/windows/filesystem.rb +4 -4
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +10 -10
- data/lib/ohai/plugins/windows/platform.rb +1 -2
- data/lib/ohai/plugins/windows/virtualization.rb +17 -17
- data/lib/ohai/provides_map.rb +7 -7
- data/lib/ohai/runner.rb +3 -3
- data/lib/ohai/system.rb +21 -20
- data/lib/ohai/util/file_helper.rb +1 -2
- data/lib/ohai/util/ip_helper.rb +4 -4
- data/lib/ohai/util/win32.rb +5 -5
- data/lib/ohai/util/win32/group_helper.rb +4 -5
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +7 -5
- data/spec/functional/application_spec.rb +23 -23
- data/spec/functional/loader_spec.rb +1 -1
- data/spec/functional/plugins/powershell_spec.rb +13 -13
- data/spec/functional/plugins/root_group_spec.rb +5 -5
- data/spec/ohai_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -9
- data/spec/support/integration_helper.rb +7 -7
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/unit/application_spec.rb +17 -17
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/dsl/plugin_spec.rb +28 -28
- data/spec/unit/hints_spec.rb +3 -3
- data/spec/unit/loader_spec.rb +9 -9
- data/spec/unit/mixin/command_spec.rb +5 -5
- data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
- data/spec/unit/mixin/softlayer_metadata_spec.rb +19 -23
- data/spec/unit/plugin_config_spec.rb +5 -5
- data/spec/unit/plugins/abort_spec.rb +3 -3
- data/spec/unit/plugins/aix/cpu_spec.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +25 -25
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -2
- data/spec/unit/plugins/aix/kernel_spec.rb +3 -3
- data/spec/unit/plugins/aix/memory_spec.rb +8 -8
- data/spec/unit/plugins/aix/network_spec.rb +38 -38
- data/spec/unit/plugins/aix/os_spec.rb +1 -2
- 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 +11 -11
- data/spec/unit/plugins/azure_spec.rb +118 -20
- data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +4 -4
- data/spec/unit/plugins/c_spec.rb +12 -12
- data/spec/unit/plugins/chef_spec.rb +2 -2
- data/spec/unit/plugins/cloud_spec.rb +37 -37
- data/spec/unit/plugins/cloud_v2_spec.rb +64 -65
- data/spec/unit/plugins/darwin/cpu_spec.rb +1 -2
- data/spec/unit/plugins/darwin/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -4
- data/spec/unit/plugins/darwin/kernel_spec.rb +6 -10
- data/spec/unit/plugins/darwin/memory_spec.rb +5 -5
- data/spec/unit/plugins/darwin/network_spec.rb +352 -353
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -2
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +3 -3
- data/spec/unit/plugins/darwin/virtualization_spec.rb +6 -6
- data/spec/unit/plugins/digital_ocean_spec.rb +38 -37
- data/spec/unit/plugins/dmi_spec.rb +3 -3
- data/spec/unit/plugins/ec2_spec.rb +97 -88
- data/spec/unit/plugins/elixir_spec.rb +1 -2
- data/spec/unit/plugins/erlang_spec.rb +2 -2
- data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
- data/spec/unit/plugins/fail_spec.rb +2 -2
- data/spec/unit/plugins/freebsd/cpu_spec.rb +14 -14
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/freebsd/kernel_spec.rb +2 -3
- data/spec/unit/plugins/freebsd/os_spec.rb +4 -5
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/gce_spec.rb +9 -9
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -2
- data/spec/unit/plugins/hostname_spec.rb +1 -2
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/ip_scopes_spec.rb +38 -38
- data/spec/unit/plugins/java_spec.rb +52 -1
- data/spec/unit/plugins/joyent_spec.rb +9 -11
- data/spec/unit/plugins/kernel_spec.rb +11 -12
- data/spec/unit/plugins/linode_spec.rb +29 -29
- data/spec/unit/plugins/linux/block_device_spec.rb +21 -21
- data/spec/unit/plugins/linux/cpu_spec.rb +3 -3
- data/spec/unit/plugins/linux/filesystem2_spec.rb +7 -7
- data/spec/unit/plugins/linux/filesystem_spec.rb +85 -86
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -3
- data/spec/unit/plugins/linux/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linux/lsb_spec.rb +1 -2
- data/spec/unit/plugins/linux/mdadm_spec.rb +4 -4
- data/spec/unit/plugins/linux/memory_spec.rb +29 -33
- data/spec/unit/plugins/linux/network_spec.rb +463 -245
- data/spec/unit/plugins/linux/platform_spec.rb +64 -65
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -2
- data/spec/unit/plugins/linux/virtualization_spec.rb +42 -42
- data/spec/unit/plugins/lua_spec.rb +1 -2
- data/spec/unit/plugins/mono_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +118 -118
- 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 -2
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -2
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -2
- data/spec/unit/plugins/openstack_spec.rb +35 -37
- data/spec/unit/plugins/os_spec.rb +7 -8
- data/spec/unit/plugins/packages_spec.rb +118 -118
- data/spec/unit/plugins/passwd_spec.rb +18 -18
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +4 -4
- data/spec/unit/plugins/platform_spec.rb +8 -9
- 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 +66 -68
- data/spec/unit/plugins/root_group_spec.rb +26 -26
- data/spec/unit/plugins/ruby_spec.rb +14 -15
- data/spec/unit/plugins/rust_spec.rb +2 -2
- data/spec/unit/plugins/sigar/network_route_spec.rb +36 -36
- data/spec/unit/plugins/softlayer_spec.rb +10 -10
- data/spec/unit/plugins/solaris2/cpu_spec.rb +20 -21
- data/spec/unit/plugins/solaris2/dmi_spec.rb +5 -6
- data/spec/unit/plugins/solaris2/filesystem.rb +5 -5
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/memory_spec.rb +5 -5
- data/spec/unit/plugins/solaris2/network_spec.rb +7 -8
- data/spec/unit/plugins/solaris2/platform_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +3 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +6 -6
- data/spec/unit/plugins/ssh_host_keys_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +19 -19
- data/spec/unit/plugins/vmware_spec.rb +28 -28
- data/spec/unit/plugins/windows/cpu_spec.rb +46 -48
- data/spec/unit/plugins/windows/memory_spec.rb +5 -5
- data/spec/unit/plugins/windows/virtualization_spec.rb +163 -163
- data/spec/unit/provides_map_spec.rb +10 -10
- data/spec/unit/runner_spec.rb +10 -10
- data/spec/unit/system_spec.rb +19 -19
- data/spec/unit/util/file_helper_spec.rb +5 -6
- data/spec/unit/util/ip_helper_spec.rb +39 -39
- metadata +31 -4
@@ -14,19 +14,19 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require File.expand_path(File.dirname(__FILE__) +
|
17
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
18
18
|
|
19
19
|
describe Ohai::System, "Windows memory plugin", :windows_only do
|
20
20
|
before do
|
21
21
|
require "wmi-lite/wmi"
|
22
22
|
@plugin = get_plugin("windows/memory")
|
23
|
-
mock_os = {
|
23
|
+
mock_os = {
|
24
24
|
"TotalVisibleMemorySize" => "10485760",
|
25
25
|
"FreePhysicalMemory" => "5242880",
|
26
26
|
"SizeStoredInPagingFiles" => "20971520",
|
27
|
-
"FreeSpaceInPagingFiles" => "15728640"
|
27
|
+
"FreeSpaceInPagingFiles" => "15728640",
|
28
28
|
}
|
29
|
-
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with(
|
29
|
+
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with("Win32_OperatingSystem").and_return(mock_os)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should get total memory" do
|
@@ -49,4 +49,4 @@ describe Ohai::System, "Windows memory plugin", :windows_only do
|
|
49
49
|
expect(@plugin["memory"]["swap"]["free"]).to eql("15728640kB")
|
50
50
|
end
|
51
51
|
|
52
|
-
end
|
52
|
+
end
|
@@ -18,197 +18,197 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require File.expand_path(File.dirname(__FILE__) +
|
21
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper.rb")
|
22
22
|
|
23
|
-
describe Ohai::System,
|
24
|
-
let(:plugin) { get_plugin(
|
23
|
+
describe Ohai::System, "Windows virtualization platform" do
|
24
|
+
let(:plugin) { get_plugin("windows/virtualization") }
|
25
25
|
|
26
26
|
before(:each) do
|
27
27
|
allow(plugin).to receive(:collect_os).and_return(:windows)
|
28
28
|
end
|
29
29
|
|
30
|
-
context
|
31
|
-
it
|
32
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
30
|
+
context "when running on vmware" do
|
31
|
+
it "system is vmware" do
|
32
|
+
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [4, 7, 8, 9, 10, 11, 12, 14, 15, 16, 19, 26, 27, 28, 29, 30, 32, 39, 40, 41, 42, 50, 57, 58],
|
33
|
+
"biosversion" => ["INTEL - 6040000", "PhoenixBIOS 4.0 Release 6.0 "],
|
34
|
+
"buildnumber" => nil,
|
35
|
+
"caption" => "PhoenixBIOS 4.0 Release 6.0 ",
|
36
|
+
"codeset" => nil, "currentlanguage" => nil,
|
37
|
+
"description" => "PhoenixBIOS 4.0 Release 6.0 ",
|
38
|
+
"identificationcode" => nil,
|
39
|
+
"installablelanguages" => nil,
|
40
|
+
"installdate" => nil,
|
41
|
+
"languageedition" => nil,
|
42
|
+
"listoflanguages" => nil,
|
43
|
+
"manufacturer" => "Phoenix Technologies LTD",
|
44
|
+
"name" => "PhoenixBIOS 4.0 Release 6.0 ",
|
45
|
+
"othertargetos" => nil,
|
46
|
+
"primarybios" => true,
|
47
|
+
"releasedate" => "20130731000000.000000+000",
|
48
|
+
"serialnumber" => "VMware-56 4d 65 24 ac cf ec 72-fa 29 b2 7d 8f df b2 7a",
|
49
|
+
"smbiosbiosversion" => "6.00",
|
50
|
+
"smbiosmajorversion" => 2,
|
51
|
+
"smbiosminorversion" => 4,
|
52
|
+
"smbiospresent" => true,
|
53
|
+
"softwareelementid" => "PhoenixBIOS 4.0 Release 6.0 ",
|
54
|
+
"softwareelementstate" => 3,
|
55
|
+
"status" => "OK",
|
56
|
+
"targetoperatingsystem" => 0,
|
57
|
+
"version" => "INTEL - 6040000"
|
58
58
|
}])
|
59
59
|
plugin.run
|
60
|
-
expect(plugin[:virtualization][:system]).to eq(
|
61
|
-
expect(plugin[:virtualization][:role]).to eq(
|
62
|
-
expect(plugin[:virtualization][:systems][:vmware]).to eq(
|
60
|
+
expect(plugin[:virtualization][:system]).to eq("vmware")
|
61
|
+
expect(plugin[:virtualization][:role]).to eq("guest")
|
62
|
+
expect(plugin[:virtualization][:systems][:vmware]).to eq("guest")
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
context
|
67
|
-
it
|
68
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
66
|
+
context "when running on parallels desktop" do
|
67
|
+
it "system is parallels" do
|
68
|
+
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [4, 7, 9, 10, 15, 24, 25, 27, 28, 29, 30, 32, 42, 44, 48, 49, 51, 64, 65, 67],
|
69
|
+
"biosversion" => ["PRLS - 1"],
|
70
|
+
"buildnumber" => nil,
|
71
|
+
"caption" => "Default System BIOS",
|
72
|
+
"codeset" => nil,
|
73
|
+
"currentlanguage" => nil,
|
74
|
+
"description" => "Default System BIOS",
|
75
|
+
"identificationcode" => nil,
|
76
|
+
"installablelanguages" => nil,
|
77
|
+
"installdate" => nil,
|
78
|
+
"languageedition" => nil,
|
79
|
+
"listoflanguages" => nil,
|
80
|
+
"manufacturer" => "Parallels Software International Inc.",
|
81
|
+
"name" => "Default System BIOS",
|
82
|
+
"othertargetos" => nil,
|
83
|
+
"primarybios" => true,
|
84
|
+
"releasedate" => "20151005000000.000000+000",
|
85
|
+
"serialnumber" => "Parallels-82 75 A0 A0 9B B4 47 7C 87 A9 D9 E1 2B 90 4B 1F",
|
86
|
+
"smbiosbiosversion" => "11.0.2 (31348)",
|
87
|
+
"smbiosmajorversion" => 2,
|
88
|
+
"smbiosminorversion" => 7,
|
89
|
+
"smbiospresent" => true,
|
90
|
+
"softwareelementid" => "Default System BIOS",
|
91
|
+
"softwareelementstate" => 3,
|
92
|
+
"status" => "OK",
|
93
|
+
"targetoperatingsystem" => 0,
|
94
|
+
"version" => "PRLS - 1",
|
95
95
|
}])
|
96
96
|
plugin.run
|
97
|
-
expect(plugin[:virtualization][:system]).to eq(
|
98
|
-
expect(plugin[:virtualization][:role]).to eq(
|
99
|
-
expect(plugin[:virtualization][:systems][:parallels]).to eq(
|
97
|
+
expect(plugin[:virtualization][:system]).to eq("parallels")
|
98
|
+
expect(plugin[:virtualization][:role]).to eq("guest")
|
99
|
+
expect(plugin[:virtualization][:systems][:parallels]).to eq("guest")
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
context
|
104
|
-
it
|
105
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
103
|
+
context "when running on kvm" do
|
104
|
+
it "system is kvm" do
|
105
|
+
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [3, 42, 48, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79],
|
106
|
+
"biosversion" => ["BOCHS - 1"],
|
107
|
+
"buildnumber" => nil,
|
108
|
+
"caption" => "Default System BIOS",
|
109
|
+
"codeset" => nil,
|
110
|
+
"currentlanguage" => nil,
|
111
|
+
"description" => "Default System BIOS",
|
112
|
+
"identificationcode" => nil,
|
113
|
+
"installablelanguages" => nil,
|
114
|
+
"installdate" => nil,
|
115
|
+
"languageedition" => nil,
|
116
|
+
"listoflanguages" => nil,
|
117
|
+
"manufacturer" => "Bochs",
|
118
|
+
"name" => "Default System BIOS",
|
119
|
+
"othertargetos" => nil,
|
120
|
+
"primarybios" => true,
|
121
|
+
"releasedate" => "20110101******.******+***",
|
122
|
+
"serialnumber" => nil,
|
123
|
+
"smbiosbiosversion" => "Bochs",
|
124
|
+
"smbiosmajorversion" => 2,
|
125
|
+
"smbiosminorversion" => 4,
|
126
|
+
"smbiospresent" => true,
|
127
|
+
"softwareelementid" => "Default System BIOS",
|
128
|
+
"softwareelementstate" => 3,
|
129
|
+
"status" => "OK",
|
130
|
+
"targetoperatingsystem" => 0, "version" => "BOCHS -1"
|
131
131
|
}])
|
132
132
|
plugin.run
|
133
|
-
expect(plugin[:virtualization][:system]).to eq(
|
134
|
-
expect(plugin[:virtualization][:role]).to eq(
|
135
|
-
expect(plugin[:virtualization][:systems][:kvm]).to eq(
|
133
|
+
expect(plugin[:virtualization][:system]).to eq("kvm")
|
134
|
+
expect(plugin[:virtualization][:role]).to eq("guest")
|
135
|
+
expect(plugin[:virtualization][:systems][:kvm]).to eq("guest")
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
context
|
140
|
-
it
|
141
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
139
|
+
context "when running on virtualbox" do
|
140
|
+
it "system is vbox" do
|
141
|
+
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [4, 7, 15, 16, 27, 30, 32],
|
142
|
+
"biosversion" => ["VBOX - 1"],
|
143
|
+
"buildnumber" => nil,
|
144
|
+
"caption" => "Default System BIOS",
|
145
|
+
"codeset" => nil,
|
146
|
+
"currentlanguage" => nil,
|
147
|
+
"description" => "Default System BIOS",
|
148
|
+
"identificationcode" => nil,
|
149
|
+
"installablelanguages" => nil,
|
150
|
+
"installdate" => nil,
|
151
|
+
"languageedition" => nil,
|
152
|
+
"listoflanguages" => nil,
|
153
|
+
"manufacturer" => "innotek GmbH",
|
154
|
+
"name" => "Default System BIOS",
|
155
|
+
"othertargetos" => nil,
|
156
|
+
"primarybios" => true,
|
157
|
+
"releasedate" => "20061201000000.000000+000",
|
158
|
+
"serialnumber" => "0",
|
159
|
+
"smbiosbiosversion" => "VirtualBox",
|
160
|
+
"smbiosmajorversion" => 2,
|
161
|
+
"smbiosminorversion" => 5,
|
162
|
+
"smbiospresent" => true,
|
163
|
+
"softwareelementid" => "Default System BIOS",
|
164
|
+
"softwareelementstate" => 3,
|
165
|
+
"status" => "OK",
|
166
|
+
"targetoperatingsystem" => 0,
|
167
|
+
"version" => "VBOX - 1",
|
168
168
|
}])
|
169
169
|
plugin.run
|
170
|
-
expect(plugin[:virtualization][:system]).to eq(
|
171
|
-
expect(plugin[:virtualization][:role]).to eq(
|
172
|
-
expect(plugin[:virtualization][:systems][:vbox]).to eq(
|
170
|
+
expect(plugin[:virtualization][:system]).to eq("vbox")
|
171
|
+
expect(plugin[:virtualization][:role]).to eq("guest")
|
172
|
+
expect(plugin[:virtualization][:systems][:vbox]).to eq("guest")
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
context
|
177
|
-
it
|
178
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with(
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
176
|
+
context "when running on a hardware system" do
|
177
|
+
it "does not set virtualization attributes" do
|
178
|
+
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [7, 11, 12, 15, 16, 17, 19, 23, 24, 25, 26, 27, 28, 29, 32, 33, 40, 42, 43],
|
179
|
+
"biosversion" => ["DELL - 1072009", "A10", "American Megatrends - 4028D"],
|
180
|
+
"buildnumber" => nil,
|
181
|
+
"caption" => "A10",
|
182
|
+
"codeset" => nil,
|
183
|
+
"currentlanguage" => nil,
|
184
|
+
"description" => "A10",
|
185
|
+
"embeddedcontrollermajorversion" => 255,
|
186
|
+
"embeddedcontrollerminorversion" => 255,
|
187
|
+
"identificationcode" => nil,
|
188
|
+
"installablelanguages" => nil,
|
189
|
+
"installdate" => nil,
|
190
|
+
"languageedition" => nil,
|
191
|
+
"listoflanguages" => nil,
|
192
|
+
"manufacturer" => "Dell Inc.",
|
193
|
+
"name" => "A10",
|
194
|
+
"othertargetos" => nil,
|
195
|
+
"primarybios" => true,
|
196
|
+
"releasedate" => "20130513000000.000000+000",
|
197
|
+
"serialnumber" => "87GBNY1",
|
198
|
+
"smbiosbiosversion" => "A10",
|
199
|
+
"smbiosmajorversion" => 2,
|
200
|
+
"smbiosminorversion" => 7,
|
201
|
+
"smbiospresent" => true,
|
202
|
+
"softwareelementid" => "A10",
|
203
|
+
"softwareelementstate" => 3,
|
204
|
+
"status" => "OK",
|
205
|
+
"systembiosmajorversion" => 4,
|
206
|
+
"systembiosminorversion" => 6,
|
207
|
+
"targetoperatingsystem" => 0,
|
208
|
+
"version" => "DELL - 1072009",
|
209
209
|
}])
|
210
210
|
plugin.run
|
211
|
-
expect(plugin[:virtualization]).to eq(
|
211
|
+
expect(plugin[:virtualization]).to eq("systems" => {})
|
212
212
|
end
|
213
213
|
end
|
214
214
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License
|
18
18
|
#
|
19
19
|
|
20
|
-
require File.expand_path(File.dirname(__FILE__) +
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
|
21
21
|
|
22
22
|
describe Ohai::ProvidesMap do
|
23
23
|
|
@@ -31,14 +31,14 @@ describe Ohai::ProvidesMap do
|
|
31
31
|
describe "when looking up providing plugins for a single attribute" do
|
32
32
|
describe "when the attribute does not exist" do
|
33
33
|
it "should raise Ohai::Exceptions::AttributeNotFound error" do
|
34
|
-
expect{ provides_map.find_providers_for(["single"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'single'")
|
34
|
+
expect { provides_map.find_providers_for(["single"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'single'")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "when the attribute does not have a provider" do
|
39
39
|
it "should raise Ohai::Exceptions::ProviderNotFound error" do
|
40
40
|
provides_map.set_providers_for(plugin_1, ["first/second"])
|
41
|
-
expect{ provides_map.find_providers_for(["first"]) }.to raise_error(Ohai::Exceptions::ProviderNotFound, "Cannot find plugin providing attribute: 'first'")
|
41
|
+
expect { provides_map.find_providers_for(["first"]) }.to raise_error(Ohai::Exceptions::ProviderNotFound, "Cannot find plugin providing attribute: 'first'")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -73,7 +73,7 @@ describe Ohai::ProvidesMap do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should return each provider" do
|
76
|
-
expect(provides_map.find_providers_for(
|
76
|
+
expect(provides_map.find_providers_for(%w{one two})).to eq([plugin_1, plugin_2])
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -85,7 +85,7 @@ describe Ohai::ProvidesMap do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should return unique providers" do
|
88
|
-
expect(provides_map.find_providers_for(
|
88
|
+
expect(provides_map.find_providers_for(%w{one one_again})).to eq([plugin_1])
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -105,13 +105,13 @@ describe Ohai::ProvidesMap do
|
|
105
105
|
describe "when setting multi-level attributes" do
|
106
106
|
describe "when the attribute contains //" do
|
107
107
|
it "should raise an Ohai::Exceptions::AttributeSyntaxError" do
|
108
|
-
expect{ provides_map.set_providers_for(plugin_1, ["this/plugin//is/bad"]) }.to raise_error(Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: this/plugin//is/bad")
|
108
|
+
expect { provides_map.set_providers_for(plugin_1, ["this/plugin//is/bad"]) }.to raise_error(Ohai::Exceptions::AttributeSyntaxError, "Attribute contains duplicate '/' characters: this/plugin//is/bad")
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "when the attribute has a trailing slash" do
|
113
113
|
it "should raise an Ohai::Exceptions::AttributeSyntaxError" do
|
114
|
-
expect{ provides_map.set_providers_for(plugin_1, ["this/plugin/is/bad/"]) }.to raise_error(Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': this/plugin/is/bad/")
|
114
|
+
expect { provides_map.set_providers_for(plugin_1, ["this/plugin/is/bad/"]) }.to raise_error(Ohai::Exceptions::AttributeSyntaxError, "Attribute contains a trailing '/': this/plugin/is/bad/")
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -154,7 +154,7 @@ describe Ohai::ProvidesMap do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it "should not raise error if a parent attribute is provided" do
|
157
|
-
expect{ provides_map.find_closest_providers_for(["do/not/eat/plastic"]) }.not_to raise_error
|
157
|
+
expect { provides_map.find_closest_providers_for(["do/not/eat/plastic"]) }.not_to raise_error
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should return the providers of the closest parent attribute" do
|
@@ -163,11 +163,11 @@ describe Ohai::ProvidesMap do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should raise error if the least-specific parent is not an attribute" do
|
166
|
-
expect{ provides_map.find_closest_providers_for(["please/eat/your/vegetables"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'please/eat/your/vegetables'")
|
166
|
+
expect { provides_map.find_closest_providers_for(["please/eat/your/vegetables"]) }.to raise_error(Ohai::Exceptions::AttributeNotFound, "No such attribute: 'please/eat/your/vegetables'")
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should raise error if no parent attribute has a provider" do
|
170
|
-
expect{ provides_map.find_closest_providers_for(["do/not"]) }.to raise_error(Ohai::Exceptions::ProviderNotFound, "Cannot find plugin providing attribute: 'do/not'")
|
170
|
+
expect { provides_map.find_closest_providers_for(["do/not"]) }.to raise_error(Ohai::Exceptions::ProviderNotFound, "Cannot find plugin providing attribute: 'do/not'")
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|