ohai 8.22.1 → 8.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ohai/application.rb +2 -0
  3. data/lib/ohai/mixin/dmi_decode.rb +2 -0
  4. data/lib/ohai/mixin/ec2_metadata.rb +14 -0
  5. data/lib/ohai/plugins/azure.rb +5 -5
  6. data/lib/ohai/plugins/c.rb +118 -46
  7. data/lib/ohai/plugins/cloud.rb +1 -0
  8. data/lib/ohai/plugins/dmi.rb +5 -5
  9. data/lib/ohai/plugins/ec2.rb +1 -0
  10. data/lib/ohai/plugins/erlang.rb +3 -5
  11. data/lib/ohai/plugins/groovy.rb +1 -1
  12. data/lib/ohai/plugins/haskell.rb +4 -4
  13. data/lib/ohai/plugins/hostname.rb +6 -6
  14. data/lib/ohai/plugins/ip_scopes.rb +1 -1
  15. data/lib/ohai/plugins/linux/network.rb +15 -15
  16. data/lib/ohai/plugins/linux/platform.rb +82 -43
  17. data/lib/ohai/plugins/linux/sessions.rb +2 -0
  18. data/lib/ohai/plugins/linux/virtualization.rb +18 -0
  19. data/lib/ohai/plugins/lua.rb +1 -1
  20. data/lib/ohai/plugins/network.rb +10 -10
  21. data/lib/ohai/plugins/scala.rb +2 -2
  22. data/lib/ohai/plugins/solaris2/dmi.rb +5 -5
  23. data/lib/ohai/plugins/sysconf.rb +45 -0
  24. data/lib/ohai/plugins/virtualbox.rb +22 -17
  25. data/lib/ohai/plugins/vmware.rb +2 -2
  26. data/lib/ohai/plugins/windows/virtualization.rb +14 -0
  27. data/lib/ohai/system.rb +0 -4
  28. data/lib/ohai/util/file_helper.rb +2 -2
  29. data/lib/ohai/version.rb +1 -1
  30. data/spec/unit/plugins/c_spec.rb +299 -266
  31. data/spec/unit/plugins/cloud_spec.rb +6 -0
  32. data/spec/unit/plugins/ec2_spec.rb +45 -1
  33. data/spec/unit/plugins/erlang_spec.rb +5 -5
  34. data/spec/unit/plugins/linux/network_spec.rb +1 -1
  35. data/spec/unit/plugins/linux/platform_spec.rb +43 -1
  36. data/spec/unit/plugins/linux/virtualization_spec.rb +19 -0
  37. data/spec/unit/plugins/network_spec.rb +23 -23
  38. data/spec/unit/plugins/sysconf_spec.rb +679 -0
  39. data/spec/unit/plugins/windows/virtualization_spec.rb +67 -0
  40. data/spec/unit/system_spec.rb +0 -1
  41. metadata +5 -3
@@ -173,6 +173,73 @@ describe Ohai::System, "Windows virtualization platform" do
173
173
  end
174
174
  end
175
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
+ }])
220
+ plugin.run
221
+ expect(plugin[:virtualization][:system]).to eq("xen")
222
+ expect(plugin[:virtualization][:role]).to eq("guest")
223
+ expect(plugin[:virtualization][:systems][:xen]).to eq("guest")
224
+ end
225
+ end
226
+
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
+
176
243
  context "when running on a hardware system" do
177
244
  it "does not set virtualization attributes" do
178
245
  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],
@@ -101,7 +101,6 @@ describe "Ohai::System" do
101
101
  it "configures logging" do
102
102
  log_level = :debug
103
103
  Ohai.config[:log_level] = log_level
104
- expect(Ohai::Log).to receive(:init).with(Ohai.config[:log_location])
105
104
  expect(Ohai::Log).to receive(:level=).with(log_level)
106
105
  Ohai::System.new
107
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.22.1
4
+ version: 8.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2017-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu
@@ -330,6 +330,7 @@ files:
330
330
  - lib/ohai/plugins/solaris2/virtualization.rb
331
331
  - lib/ohai/plugins/solaris2/zpools.rb
332
332
  - lib/ohai/plugins/ssh_host_key.rb
333
+ - lib/ohai/plugins/sysconf.rb
333
334
  - lib/ohai/plugins/timezone.rb
334
335
  - lib/ohai/plugins/uptime.rb
335
336
  - lib/ohai/plugins/virtualbox.rb
@@ -511,6 +512,7 @@ files:
511
512
  - spec/unit/plugins/solaris2/virtualization_spec.rb
512
513
  - spec/unit/plugins/solaris2/zpools_spec.rb
513
514
  - spec/unit/plugins/ssh_host_keys_spec.rb
515
+ - spec/unit/plugins/sysconf_spec.rb
514
516
  - spec/unit/plugins/timezone_spec.rb
515
517
  - spec/unit/plugins/virtualbox_spec.rb
516
518
  - spec/unit/plugins/vmware_spec.rb
@@ -544,7 +546,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
544
546
  version: '0'
545
547
  requirements: []
546
548
  rubyforge_project:
547
- rubygems_version: 2.6.8
549
+ rubygems_version: 2.5.2
548
550
  signing_key:
549
551
  specification_version: 4
550
552
  summary: Ohai profiles your system and emits JSON