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
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
|
17
|
+
require "spec_helper"
|
18
18
|
|
19
19
|
describe Ohai::System, "Windows memory plugin", :windows_only do
|
20
20
|
before do
|
@@ -24,7 +24,7 @@ describe Ohai::System, "Windows memory plugin", :windows_only do
|
|
24
24
|
"TotalVisibleMemorySize" => "10485760",
|
25
25
|
"FreePhysicalMemory" => "5242880",
|
26
26
|
"SizeStoredInPagingFiles" => "20971520",
|
27
|
-
"FreeSpaceInPagingFiles" =>
|
27
|
+
"FreeSpaceInPagingFiles" => "15728640",
|
28
28
|
}
|
29
29
|
expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with("Win32_OperatingSystem").and_return(mock_os)
|
30
30
|
end
|
@@ -18,205 +18,27 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
|
21
|
+
require "spec_helper"
|
22
22
|
|
23
23
|
describe Ohai::System, "Windows virtualization platform" do
|
24
24
|
let(:plugin) { get_plugin("windows/virtualization") }
|
25
|
+
let(:wmi) { double("WmiLite::Wmi") }
|
25
26
|
|
26
27
|
before(:each) do
|
28
|
+
allow(WmiLite::Wmi).to receive(:new).and_return(wmi)
|
27
29
|
allow(plugin).to receive(:collect_os).and_return(:windows)
|
28
30
|
end
|
29
31
|
|
30
|
-
|
32
|
+
describe "it sets virtualization guest status from Win32_ComputerSystemProduct data" do
|
31
33
|
it "system is vmware" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
}])
|
59
|
-
plugin.run
|
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
|
-
end
|
64
|
-
end
|
65
|
-
|
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
|
-
}])
|
96
|
-
plugin.run
|
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
|
-
end
|
101
|
-
end
|
102
|
-
|
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
|
-
}])
|
132
|
-
plugin.run
|
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
|
-
end
|
137
|
-
end
|
138
|
-
|
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
|
-
}])
|
169
|
-
plugin.run
|
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
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
context "when running on hyper-v" do
|
177
|
-
it "system is hyper-v" do
|
178
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "bioscharacteristics" => [4, 7, 9, 11, 12, 14, 15, 16, 17, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34, 36, 37, 40],
|
179
|
-
"biosversion" => ["VRTUAL - 4001628, BIOS Date: 04/28/16 13:00:17 Ver: 09.00.06, BIOS Date: 04/28/16 13:00:17 Ver: 09.00.06"],
|
180
|
-
"buildnumber" => nil,
|
181
|
-
"codeset" => nil,
|
182
|
-
"currentlanguage" => "enUS",
|
183
|
-
"description" => "BIOS Date: 04/28/16 13:00:17 Ver: 09.00.06",
|
184
|
-
"identificationcode" => nil,
|
185
|
-
"installablelanguages" => 1,
|
186
|
-
"installdate" => nil,
|
187
|
-
"languageedition" => nil,
|
188
|
-
"listoflanguages" => ["enUS"],
|
189
|
-
"manufacturer" => "American Megatrends Inc.",
|
190
|
-
"name" => "BIOS Date: 04/28/16 13:00:17 Ver: 09.00.06",
|
191
|
-
"othertargetos" => nil,
|
192
|
-
"primarybios" => true,
|
193
|
-
"releasedate" => "20160428000000.000000+000",
|
194
|
-
"serialnumber" => "1158-1757-7941-3855-2170-4122-00",
|
195
|
-
"smbiosbiosversion" => "090006",
|
196
|
-
"smbiosmajorversion" => 2,
|
197
|
-
"smbiosminorversion" => 3,
|
198
|
-
"smbiospresent" => true,
|
199
|
-
"softwareelementid" => "BIOS Date: 04/28/16 13:00:17 Ver: 09.00.06",
|
200
|
-
"softwareelementstate" => 3,
|
201
|
-
"status" => "OK",
|
202
|
-
"targetoperatingsystem" => 0,
|
203
|
-
"version" => "VRTUAL - 4001628",
|
204
|
-
}])
|
205
|
-
plugin.run
|
206
|
-
expect(plugin[:virtualization][:system]).to eq("hyper-v")
|
207
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
208
|
-
expect(plugin[:virtualization][:systems][:hyperv]).to eq("guest")
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
context "when running on xen" do
|
213
|
-
it "system is xen" do
|
214
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "smbiosbiosversion" => ["4.2.amazon"],
|
215
|
-
"manufacturer" => "Xen",
|
216
|
-
"name" => "Revision: 1.221",
|
217
|
-
"serialnumber" => "ec2b487f-d9ed-7d17-c7c0-1d4599d6c1da",
|
218
|
-
"version" => "Xen - 0",
|
219
|
-
}])
|
34
|
+
allow(wmi).to receive(:first_of).with("Win32_ComputerSystemProduct").and_return( { "caption" => "Computer System Product",
|
35
|
+
"description" => "Computer System Product",
|
36
|
+
"identifyingnumber" => "ec2d6aad-f59b-a10d-5784-ca9b7ba4f727",
|
37
|
+
"name" => "HVM domU",
|
38
|
+
"skunumber" => nil,
|
39
|
+
"uuid" => "EC2D6AAD-F59B-A10D-5784-CA9B7BA4F727",
|
40
|
+
"vendor" => "Xen",
|
41
|
+
"version" => "4.2.amazon" } )
|
220
42
|
plugin.run
|
221
43
|
expect(plugin[:virtualization][:system]).to eq("xen")
|
222
44
|
expect(plugin[:virtualization][:role]).to eq("guest")
|
@@ -224,56 +46,16 @@ describe Ohai::System, "Windows virtualization platform" do
|
|
224
46
|
end
|
225
47
|
end
|
226
48
|
|
227
|
-
context "when running on veertu" do
|
228
|
-
it "system is veertu" do
|
229
|
-
allow_any_instance_of(WmiLite::Wmi).to receive(:instances_of).with("Win32_BIOS").and_return([{ "smbiosbiosversion" => ["Veertu"],
|
230
|
-
"manufacturer" => "Veertu",
|
231
|
-
"name" => "Default System BIOS",
|
232
|
-
"serialnumber" => "",
|
233
|
-
"version" => "Veertu - 1",
|
234
|
-
|
235
|
-
}])
|
236
|
-
plugin.run
|
237
|
-
expect(plugin[:virtualization][:system]).to eq("veertu")
|
238
|
-
expect(plugin[:virtualization][:role]).to eq("guest")
|
239
|
-
expect(plugin[:virtualization][:systems][:veertu]).to eq("guest")
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
49
|
context "when running on a hardware system" do
|
244
50
|
it "does not set virtualization attributes" do
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
"embeddedcontrollerminorversion" => 255,
|
254
|
-
"identificationcode" => nil,
|
255
|
-
"installablelanguages" => nil,
|
256
|
-
"installdate" => nil,
|
257
|
-
"languageedition" => nil,
|
258
|
-
"listoflanguages" => nil,
|
259
|
-
"manufacturer" => "Dell Inc.",
|
260
|
-
"name" => "A10",
|
261
|
-
"othertargetos" => nil,
|
262
|
-
"primarybios" => true,
|
263
|
-
"releasedate" => "20130513000000.000000+000",
|
264
|
-
"serialnumber" => "87GBNY1",
|
265
|
-
"smbiosbiosversion" => "A10",
|
266
|
-
"smbiosmajorversion" => 2,
|
267
|
-
"smbiosminorversion" => 7,
|
268
|
-
"smbiospresent" => true,
|
269
|
-
"softwareelementid" => "A10",
|
270
|
-
"softwareelementstate" => 3,
|
271
|
-
"status" => "OK",
|
272
|
-
"systembiosmajorversion" => 4,
|
273
|
-
"systembiosminorversion" => 6,
|
274
|
-
"targetoperatingsystem" => 0,
|
275
|
-
"version" => "DELL - 1072009",
|
276
|
-
}])
|
51
|
+
allow(wmi).to receive(:first_of).with("Win32_ComputerSystemProduct").and_return({ "caption" => "Computer System Product",
|
52
|
+
"description" => "Computer System Product",
|
53
|
+
"identifyingnumber" => "0123456789",
|
54
|
+
"name" => "X10SLH-N6-ST031",
|
55
|
+
"skunumber" => nil,
|
56
|
+
"uuid" => "00000000-0000-0000-0000-0CC47A8F7618",
|
57
|
+
"vendor" => "Supermicro",
|
58
|
+
"version" => "0123456789" })
|
277
59
|
plugin.run
|
278
60
|
expect(plugin[:virtualization]).to eq("systems" => {})
|
279
61
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
|
16
|
-
|
16
|
+
require "spec_helper"
|
17
17
|
|
18
18
|
describe Ohai::System, "zpools plugin" do
|
19
19
|
let(:plugin) { get_plugin("zpools") }
|
@@ -42,13 +42,13 @@ describe Ohai::System, "zpools plugin" do
|
|
42
42
|
sdl ONLINE 0 0 0
|
43
43
|
sdm ONLINE 0 0 0
|
44
44
|
sdn ONLINE 0 0 0
|
45
|
-
EOST
|
45
|
+
EOST
|
46
46
|
end
|
47
47
|
let(:zpool_out) do
|
48
48
|
<<~EOZO
|
49
49
|
rpool 109G 66.2G 42.8G 60% 1.00x ONLINE -
|
50
50
|
tank 130T 4.91M 130T 0% 1.00x ONLINE -
|
51
|
-
EOZO
|
51
|
+
EOZO
|
52
52
|
end
|
53
53
|
let(:zpool_status_rpool) do
|
54
54
|
<<-EOSR
|
@@ -64,7 +64,7 @@ EOZO
|
|
64
64
|
sdb ONLINE 0 0 0
|
65
65
|
|
66
66
|
errors: No known data errors
|
67
|
-
EOSR
|
67
|
+
EOSR
|
68
68
|
end
|
69
69
|
before do
|
70
70
|
allow(plugin).to receive(:platform_family).and_return("rhel")
|
@@ -153,13 +153,13 @@ EOSR
|
|
153
153
|
c1t50014EE25F697DC4d0 ONLINE 0 0 0
|
154
154
|
c1t50014EE25F698BECd0 ONLINE 0 0 0
|
155
155
|
c1t50014EE25F6998DAd0 ONLINE 0 0 0
|
156
|
-
EOST
|
156
|
+
EOST
|
157
157
|
end
|
158
158
|
let(:zpool_out) do
|
159
159
|
<<~EOZO
|
160
160
|
rpool 109G 66.2G 42.8G 60% 1.00x ONLINE 34
|
161
161
|
tank 130T 4.91M 130T 0% 1.00x ONLINE 34
|
162
|
-
EOZO
|
162
|
+
EOZO
|
163
163
|
end
|
164
164
|
let(:zpool_status_rpool) do
|
165
165
|
<<~EOSR
|
@@ -175,7 +175,7 @@ EOZO
|
|
175
175
|
c3t4d0s0 ONLINE 0 0 0
|
176
176
|
|
177
177
|
errors: No known data errors
|
178
|
-
EOSR
|
178
|
+
EOSR
|
179
179
|
end
|
180
180
|
before do
|
181
181
|
allow(plugin).to receive(:platform_family).and_return("solaris2")
|
data/spec/unit/runner_spec.rb
CHANGED
data/spec/unit/system_spec.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
|
20
|
+
require "spec_helper"
|
21
21
|
require "ohai/mixin/os"
|
22
22
|
|
23
23
|
describe "Ohai::System" do
|
@@ -102,25 +102,25 @@ describe "Ohai::System" do
|
|
102
102
|
Ohai.plugin(:Zoo) do
|
103
103
|
provides 'seals'
|
104
104
|
end
|
105
|
-
EOF
|
105
|
+
EOF
|
106
106
|
|
107
107
|
with_plugin("repo1/lake.rb", <<~EOF)
|
108
108
|
Ohai.plugin(:Nature) do
|
109
109
|
provides 'fish'
|
110
110
|
end
|
111
|
-
EOF
|
111
|
+
EOF
|
112
112
|
|
113
113
|
with_plugin("repo2/nature.rb", <<~EOF)
|
114
114
|
Ohai.plugin(:Nature) do
|
115
115
|
provides 'crabs'
|
116
116
|
end
|
117
|
-
EOF
|
117
|
+
EOF
|
118
118
|
|
119
119
|
with_plugin("repo2/mountain.rb", <<~EOF)
|
120
120
|
Ohai.plugin(:Nature) do
|
121
121
|
provides 'bear'
|
122
122
|
end
|
123
|
-
EOF
|
123
|
+
EOF
|
124
124
|
|
125
125
|
before do
|
126
126
|
Ohai.config[:plugin_path] = [ path_to("repo1"), path_to("repo2") ]
|
@@ -150,7 +150,7 @@ EOF
|
|
150
150
|
message("platform_specific_message")
|
151
151
|
end
|
152
152
|
end
|
153
|
-
EOF
|
153
|
+
EOF
|
154
154
|
|
155
155
|
it "should collect platform specific" do
|
156
156
|
Ohai.config[:plugin_path] = [ path_to(".") ]
|
@@ -168,7 +168,7 @@ EOF
|
|
168
168
|
zoo("animals")
|
169
169
|
end
|
170
170
|
end
|
171
|
-
EOF
|
171
|
+
EOF
|
172
172
|
|
173
173
|
with_plugin("park.rb", <<~EOF)
|
174
174
|
Ohai.plugin(:Park) do
|
@@ -177,7 +177,7 @@ EOF
|
|
177
177
|
park("plants")
|
178
178
|
end
|
179
179
|
end
|
180
|
-
EOF
|
180
|
+
EOF
|
181
181
|
|
182
182
|
with_plugin("fails.rb", <<~EOF)
|
183
183
|
Ohai.plugin(:Fails) do
|
@@ -186,7 +186,7 @@ EOF
|
|
186
186
|
fail 'thing'
|
187
187
|
end
|
188
188
|
end
|
189
|
-
EOF
|
189
|
+
EOF
|
190
190
|
|
191
191
|
with_plugin("optional.rb", <<~EOF)
|
192
192
|
Ohai.plugin(:Optional) do
|
@@ -197,7 +197,7 @@ EOF
|
|
197
197
|
optional("canteloupe")
|
198
198
|
end
|
199
199
|
end
|
200
|
-
EOF
|
200
|
+
EOF
|
201
201
|
|
202
202
|
it "should collect data from all the plugins" do
|
203
203
|
Ohai.config[:plugin_path] = [ path_to(".") ]
|
@@ -305,73 +305,6 @@ EOF
|
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
308
|
-
describe "when refreshing plugins" do
|
309
|
-
when_plugins_directory "contains v7 plugins" do
|
310
|
-
with_plugin("desired.rb", <<-E)
|
311
|
-
Ohai.plugin(:DesiredPlugin) do
|
312
|
-
provides 'desired_attr'
|
313
|
-
depends 'depended_attr'
|
314
|
-
|
315
|
-
collect_data do
|
316
|
-
desired_attr "hello"
|
317
|
-
self[:desired_attr_count] ||= 0
|
318
|
-
self[:desired_attr_count] += 1
|
319
|
-
end
|
320
|
-
end
|
321
|
-
E
|
322
|
-
|
323
|
-
with_plugin("depended.rb", <<-E)
|
324
|
-
Ohai.plugin(:DependedPlugin) do
|
325
|
-
provides 'depended_attr'
|
326
|
-
|
327
|
-
collect_data do
|
328
|
-
depended_attr "hello"
|
329
|
-
self[:depended_attr_count] ||= 0
|
330
|
-
self[:depended_attr_count] += 1
|
331
|
-
end
|
332
|
-
end
|
333
|
-
E
|
334
|
-
|
335
|
-
with_plugin("other.rb", <<-E)
|
336
|
-
Ohai.plugin(:OtherPlugin) do
|
337
|
-
provides 'other_attr'
|
338
|
-
|
339
|
-
collect_data do
|
340
|
-
other_attr "hello"
|
341
|
-
self[:other_attr_count] ||= 0
|
342
|
-
self[:other_attr_count] += 1
|
343
|
-
end
|
344
|
-
end
|
345
|
-
E
|
346
|
-
|
347
|
-
before do
|
348
|
-
Ohai.config[:plugin_path] = [ path_to(".") ]
|
349
|
-
Ohai::Log.init(STDOUT)
|
350
|
-
Ohai::Log.level = :debug
|
351
|
-
ohai.all_plugins
|
352
|
-
end
|
353
|
-
|
354
|
-
it "should rerun the plugin providing the desired attributes" do
|
355
|
-
expect(ohai.data[:desired_attr_count]).to eq(1)
|
356
|
-
ohai.refresh_plugins("desired_attr")
|
357
|
-
expect(ohai.data[:desired_attr_count]).to eq(2)
|
358
|
-
end
|
359
|
-
|
360
|
-
it "should not re-run dependencies of the plugin providing the desired attributes" do
|
361
|
-
expect(ohai.data[:depended_attr_count]).to eq(1)
|
362
|
-
ohai.refresh_plugins("desired_attr")
|
363
|
-
expect(ohai.data[:depended_attr_count]).to eq(1)
|
364
|
-
end
|
365
|
-
|
366
|
-
it "should not re-run plugins unrelated to the plugin providing the desired attributes" do
|
367
|
-
expect(ohai.data[:other_attr_count]).to eq(1)
|
368
|
-
ohai.refresh_plugins("desired_attr")
|
369
|
-
expect(ohai.data[:other_attr_count]).to eq(1)
|
370
|
-
end
|
371
|
-
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
308
|
describe "when running ohai for specific attributes" do
|
376
309
|
when_plugins_directory "contains v7 plugins" do
|
377
310
|
with_plugin("languages.rb", <<-E)
|