ohai 8.3.0 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126cc8aea8018c470f57fecaadab6f176ba76e46
4
- data.tar.gz: 44bd077bf56631f93bb71cd0fab55ef9bc826549
3
+ metadata.gz: 036936f26eb1e8ff1d24656e93a1274bc2a5c115
4
+ data.tar.gz: 832dd245bca01ebdc443af9c0fdd5e5b5346243b
5
5
  SHA512:
6
- metadata.gz: bf217e044c0c551ff5b1a5225403de3ed380f2f24449b7225f7583ab459ac096f65f3bc48a2186b8dade3f18d1281004764e5d80de369a431f2e767b56806c38
7
- data.tar.gz: 32af8885f0290102396cfcd140d02fc158d7502fc487f556beb87dcd0f589d0c5ed8a6a1599f702ab19fdc37485152d8954ea981b051c8148742e21868013360
6
+ metadata.gz: c0ce10ecd7bee45863d127dd60048987e57fad2191068219ec1a0c6af66577b9cde5ee429d203dd0526f14bb39f5edd10e645a2248fa2a6fca77ead1ac20f5a6
7
+ data.tar.gz: 26f1fd48769e60f05b344137d70d5fd701af2f982697722206c678ffb622bb0b10e89b98b6b8909bf6fe31a1fe8be65e4e57f14f4dc863b4ca34b676cde804dc
data/README.md CHANGED
@@ -16,15 +16,15 @@ Chef distributes ohai as a RubyGem. This README is for developers who
16
16
  want to modify the Ohai source code. For users who want to write plugins
17
17
  for Ohai, see the docs:
18
18
 
19
- * General documentation: http://docs.opscode.com/ohai.html
20
- * Custom plugin documentation: http://docs.opscode.com/ohai_custom.html
19
+ * General documentation: http://docs.chef.io/ohai.html
20
+ * Custom plugin documentation: http://docs.chef.io/ohai_custom.html
21
21
 
22
22
  # DEVELOPMENT:
23
23
 
24
24
  Before working on the code, if you plan to contribute your changes, you
25
25
  should read the contributing guidelines:
26
26
 
27
- * https://github.com/opscode/ohai/blob/master/CONTRIBUTING.md
27
+ * https://github.com/chef/ohai/blob/master/CONTRIBUTING.md
28
28
 
29
29
  The basic process for contributing is:
30
30
 
@@ -67,17 +67,17 @@ Ohai has some Rake tasks for doing various things.
67
67
 
68
68
  Source:
69
69
 
70
- * http://github.com/opscode/ohai/tree/master
70
+ * http://github.com/chef/ohai/tree/master
71
71
 
72
72
  Issues:
73
73
 
74
- * https://github.com/opscode/ohai/issues
74
+ * https://github.com/chef/ohai/issues
75
75
 
76
76
  # LICENSE:
77
77
 
78
78
  Ohai - system information application
79
79
 
80
- * Author:: Adam Jacob (<adam@getchef.com>)
80
+ * Author:: Adam Jacob (<adam@chef.io>)
81
81
  * Copyright:: Copyright (c) 2008-2014 Chef Software, Inc.
82
82
  * License:: Apache License, Version 2.0
83
83
 
@@ -75,7 +75,10 @@ Ohai.plugin(:DMI) do
75
75
 
76
76
  elsif handle = handle_line.match(line)
77
77
  # Don't overcapture for now (OHAI-260)
78
- next unless Ohai::Common::DMI::IdToCapture.include?(handle[2].to_i)
78
+ unless Ohai::Common::DMI::IdToCapture.include?(handle[2].to_i)
79
+ dmi_record = nil
80
+ next
81
+ end
79
82
 
80
83
  dmi_record = {:type => Ohai::Common::DMI.id_lookup(handle[2])}
81
84
 
@@ -177,8 +177,13 @@ Ohai.plugin(:Kernel) do
177
177
 
178
178
  host = wmi.first_of('Win32_ComputerSystem')
179
179
  kernel[:cs_info] = Mash.new
180
+ cs_info_blacklist = [
181
+ 'oem_logo_bitmap'
182
+ ]
180
183
  host.wmi_ole_object.properties_.each do |p|
181
- kernel[:cs_info][p.name.wmi_underscore.to_sym] = host[p.name.downcase]
184
+ if !cs_info_blacklist.include?(p.name.wmi_underscore)
185
+ kernel[:cs_info][p.name.wmi_underscore.to_sym] = host[p.name.downcase]
186
+ end
182
187
  end
183
188
 
184
189
  kernel[:machine] = machine_lookup("#{kernel[:cs_info][:system_type]}")
@@ -17,8 +17,11 @@
17
17
  #
18
18
 
19
19
  Ohai.plugin(:DMI) do
20
+ provides "dmi"
20
21
 
21
22
  collect_data(:solaris2) do
23
+ require 'ohai/common/dmi'
24
+
22
25
  # if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios
23
26
  # note that a single key just means dmidecode exited with its version
24
27
  if (dmi.class.to_s == 'Mash') and (dmi.keys.length > 1)
@@ -72,6 +75,9 @@ Ohai.plugin(:DMI) do
72
75
  'SMB_TYPE_MEMCHAN' => 37, # memory channel
73
76
  'SMB_TYPE_IPMIDEV' => 38, # IPMI device information
74
77
  'SMB_TYPE_POWERSUP' => 39, # system power supply
78
+ 'SMB_TYPE_ADDINFO' => 40, # additional information
79
+ 'SMB_TYPE_OBDEVEXT' => 41, # on-board device extended info
80
+ 'SMB_TYPE_MCHI' => 42, # mgmt controller host interface
75
81
  'SMB_TYPE_INACTIVE' => 126, # inactive table entry
76
82
  'SMB_TYPE_EOT' => 127, # end of table
77
83
  'SMB_TYPE_OEM_LO' => 128, # start of OEM-specific type range
@@ -120,11 +126,20 @@ Ohai.plugin(:DMI) do
120
126
 
121
127
  # look up SMB ID
122
128
  if smb_to_id.has_key?(header_information[3])
123
- dmi_record[:type] = DMI.id_lookup(smb_to_id[header_information[3]])
129
+ id = smb_to_id[header_information[3]]
130
+
131
+ # Don't overcapture for now (OHAI-260)
132
+ unless Ohai::Common::DMI::IdToCapture.include?(id)
133
+ dmi_record = nil
134
+ next
135
+ end
136
+
137
+ dmi_record[:type] = Ohai::Common::DMI.id_lookup(id)
124
138
 
125
139
  else
126
- dmi_record[:type] = header_information[3].downcase
127
- Ohai::Log.debug("unrecognized header type; falling back to #{dmi_record[:type]}")
140
+ Ohai::Log.debug("unrecognized header type; skipping")
141
+ dmi_record = nil
142
+ next
128
143
  end
129
144
 
130
145
  dmi[dmi_record[:type]] = Mash.new unless dmi.has_key?(dmi_record[:type])
@@ -171,6 +186,6 @@ Ohai.plugin(:DMI) do
171
186
  end
172
187
  end
173
188
 
174
- DMI.convenience_keys(dmi)
189
+ Ohai::Common::DMI.convenience_keys(dmi)
175
190
  end
176
191
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = '8.3.0'
21
+ VERSION = '8.4.0'
22
22
  end
@@ -73,6 +73,15 @@ Base Board Information
73
73
  Type: Unknown
74
74
  Contained Object Handles: 0
75
75
 
76
+ Handle 0x1000, DMI type 16, 15 bytes
77
+ Physical Memory Array
78
+ Location: Other
79
+ Use: System Memory
80
+ Error Correction Type: Multi-bit ECC
81
+ Maximum Capacity: 2 GB
82
+ Error Information Handle: Not Provided
83
+ Number Of Devices: 1
84
+
76
85
  Handle 0x0003, DMI type 3, 21 bytes
77
86
  Chassis Information
78
87
  Manufacturer: No Enclosure
@@ -131,4 +140,9 @@ describe Ohai::System, "plugin dmi" do
131
140
  end
132
141
  end
133
142
  end
143
+
144
+ it "should correctly ignore unwanted data" do
145
+ @plugin.run
146
+ expect(@plugin[:dmi][:base_board]).not_to have_key(:error_correction_type)
147
+ end
134
148
  end
@@ -0,0 +1,154 @@
1
+ #
2
+ # Author:: Thom May (<thom@chef.io>)
3
+ # Copyright:: Copyright (c) 2015 Chef Software
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
20
+
21
+ SOLARIS_DMI_OUT = <<-EOS
22
+ ID SIZE TYPE
23
+ 0 64 SMB_TYPE_BIOS (type 0) (BIOS information)
24
+
25
+ Vendor: American Megatrends Inc.
26
+ Version String: 4701
27
+ Release Date: 08/26/2014
28
+ Address Segment: 0xf000
29
+ ROM Size: 8388608 bytes
30
+ Image Size: 65536 bytes
31
+ Characteristics: 0x53f8b9c80
32
+ SMB_BIOSFL_PCI (PCI is supported)
33
+ SMB_BIOSFL_APM (APM is supported)
34
+ SMB_BIOSFL_FLASH (BIOS is Flash Upgradeable)
35
+ SMB_BIOSFL_SHADOW (BIOS shadowing is allowed)
36
+ SMB_BIOSFL_CDBOOT (Boot from CD is supported)
37
+ SMB_BIOSFL_SELBOOT (Selectable Boot supported)
38
+ SMB_BIOSFL_ROMSOCK (BIOS ROM is socketed)
39
+ SMB_BIOSFL_EDD (EDD Spec is supported)
40
+ SMB_BIOSFL_525_12M (int 0x13 5.25" 1.2M floppy)
41
+ SMB_BIOSFL_35_720K (int 0x13 3.5" 720K floppy)
42
+ SMB_BIOSFL_35_288M (int 0x13 3.5" 2.88M floppy)
43
+ SMB_BIOSFL_I5_PRINT (int 0x5 print screen svcs)
44
+ SMB_BIOSFL_I9_KBD (int 0x9 8042 keyboard svcs)
45
+ SMB_BIOSFL_I14_SER (int 0x14 serial svcs)
46
+ SMB_BIOSFL_I17_PRINTER (int 0x17 printer svcs)
47
+ 0x100000000
48
+ 0x400000000
49
+ Characteristics Extension Byte 1: 0x3
50
+ SMB_BIOSXB1_ACPI (ACPI is supported)
51
+ SMB_BIOSXB1_USBL (USB legacy is supported)
52
+ Characteristics Extension Byte 2: 0xd
53
+ SMB_BIOSXB2_BBOOT (BIOS Boot Specification supported)
54
+ SMB_BIOSXB2_ETCDIST (Enable Targeted Content Distrib.)
55
+ SMB_BIOSXB2_UEFI (UEFI Specification supported)
56
+ Version Number: 0.0
57
+ Embedded Ctlr Firmware Version Number: 0.0
58
+
59
+ ID SIZE TYPE
60
+ 1 129 SMB_TYPE_SYSTEM (type 1) (system information)
61
+
62
+ Manufacturer: System manufacturer
63
+ Product: System Product Name
64
+ Version: System Version
65
+ Serial Number: System Serial Number
66
+
67
+ UUID: 20b1001e-8c00-0072-5566-10c37b474fc1
68
+ Wake-Up Event: 0x6 (power switch)
69
+ SKU Number: SKU
70
+ Family: To be filled by O.E.M.
71
+
72
+ ID SIZE TYPE
73
+ 2 116 SMB_TYPE_BASEBOARD (type 2) (base board)
74
+
75
+ Manufacturer: ASUSTeK COMPUTER INC.
76
+ Product: P9X79 WS
77
+ Version: Rev 1.xx
78
+ Serial Number: 140525831000250
79
+ Asset Tag: To be filled by O.E.M.
80
+ Location Tag: To be filled by O.E.M.
81
+
82
+ Chassis: 3
83
+ Flags: 0x9
84
+ SMB_BBFL_MOTHERBOARD (board is a motherboard)
85
+ SMB_BBFL_REPLACABLE (board is field-replacable)
86
+ Board Type: 0xa (motherboard)
87
+
88
+ ID SIZE TYPE
89
+ 46 38 SMB_TYPE_OBDEVS (type 10) (on-board devices)
90
+
91
+ Onboard Ethernet
92
+ Onboard Audio
93
+
94
+ ID SIZE TYPE
95
+ 3 106 SMB_TYPE_CHASSIS (type 3) (system enclosure or chassis)
96
+
97
+ Manufacturer: Chassis Manufacture
98
+ Version: Chassis Version
99
+ Serial Number: Chassis Serial Number
100
+ Asset Tag: PCS
101
+
102
+ OEM Data: 0x0
103
+ SKU number: ^E
104
+ Lock Present: N
105
+ Chassis Type: 0x3 (desktop)
106
+ Boot-Up State: 0x3 (safe)
107
+ Power Supply State: 0x3 (safe)
108
+ Thermal State: 0x3 (safe)
109
+ Chassis Height: 0u
110
+ Power Cords: 1
111
+ Element Records: 0
112
+ EOS
113
+
114
+ describe Ohai::System, "Solaris2.X DMI plugin" do
115
+ before(:each) do
116
+ @plugin = get_plugin("solaris2/dmi")
117
+ allow(@plugin).to receive(:collect_os).and_return("solaris2")
118
+ @stdout = SOLARIS_DMI_OUT
119
+ allow(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
120
+ end
121
+
122
+ it "should run smbios" do
123
+ expect(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
124
+ @plugin.run
125
+ end
126
+
127
+ {
128
+ bios: {
129
+ vendor: "American Megatrends Inc.",
130
+ release_date: "08/26/2014"
131
+ },
132
+ system: {
133
+ manufacturer: "System manufacturer",
134
+ product: "System Product Name"
135
+ },
136
+ chassis: {
137
+ lock_present: "N",
138
+ asset_tag: "PCS"
139
+ }
140
+ }.each do |id, data|
141
+ data.each do |attribute, value|
142
+ it "should have [:dmi][:#{id}][:#{attribute}] set" do
143
+ @plugin.run
144
+ expect(@plugin[:dmi][id][attribute]).to eql(value)
145
+ end
146
+ end
147
+ end
148
+
149
+ it "should ignore unwanted types" do
150
+ @plugin.run
151
+ expect(@plugin[:dmi]).not_to have_key(:on_board_devices)
152
+ end
153
+ end
154
+
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.3.0
4
+ version: 8.4.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: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -503,6 +503,7 @@ files:
503
503
  - spec/unit/plugins/rust_spec.rb
504
504
  - spec/unit/plugins/sigar/network_route_spec.rb
505
505
  - spec/unit/plugins/solaris2/cpu_spec.rb
506
+ - spec/unit/plugins/solaris2/dmi_spec.rb
506
507
  - spec/unit/plugins/solaris2/hostname_spec.rb
507
508
  - spec/unit/plugins/solaris2/kernel_spec.rb
508
509
  - spec/unit/plugins/solaris2/memory_spec.rb
@@ -536,9 +537,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
536
537
  version: '0'
537
538
  requirements: []
538
539
  rubyforge_project:
539
- rubygems_version: 2.4.4
540
+ rubygems_version: 2.4.5
540
541
  signing_key:
541
542
  specification_version: 4
542
543
  summary: Ohai profiles your system and emits JSON
543
544
  test_files: []
544
- has_rdoc: