ohai 17.9.1 → 17.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/lib/ohai/common/dmi.rb +60 -56
- data/lib/ohai/mixin/alibaba_metadata.rb +15 -10
- data/lib/ohai/mixin/network_helper.rb +6 -4
- data/lib/ohai/plugins/rpm.rb +11 -9
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f1c149d4e95abb73e9d2ec15f6318c5b6b588ff2369b68ca1b8a3d26cd69826
|
4
|
+
data.tar.gz: 52dd3e1df41fd3709051a85fe5cba9775ebc739998de03079f9afc8dee9fa652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6aa99445c427e776d6ce7eed4077a9f887997b5fe2a3f17f2c9cc4f19bf6fe542afc5e48b780c6b552f9a777040d751ac571d0f3751b0932c574ac86c844831
|
7
|
+
data.tar.gz: 1b43dc4b727518ec92627e4833897aec7f05f2000f11bdb4595fd6a06e0fe9cca3a25c7b41bc6914988fd1e29f7bc26f101e98703b385e82a341fd02c02424aa
|
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@ source "https://rubygems.org"
|
|
3
3
|
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
# pull these gems from
|
7
|
-
gem "chef-config", git: "https://github.com/chef/chef", branch: "
|
8
|
-
gem "chef-utils", git: "https://github.com/chef/chef", branch: "
|
6
|
+
# pull these gems from chef-17 of chef/chef so that we're testing against what we will release
|
7
|
+
gem "chef-config", git: "https://github.com/chef/chef", branch: "chef-17", glob: "chef-config/chef-config.gemspec"
|
8
|
+
gem "chef-utils", git: "https://github.com/chef/chef", branch: "chef-17", glob: "chef-utils/chef-utils.gemspec"
|
9
9
|
|
10
10
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
11
11
|
group :development do
|
@@ -16,7 +16,7 @@ group :development do
|
|
16
16
|
gem "rspec-core", "~> 3.0"
|
17
17
|
gem "rspec-expectations", "~> 3.0"
|
18
18
|
gem "rspec-mocks", "~> 3.0"
|
19
|
-
gem "rubocop-performance", "1.
|
19
|
+
gem "rubocop-performance", "1.12.0"
|
20
20
|
gem "rubocop-rspec"
|
21
21
|
end
|
22
22
|
|
data/lib/ohai/common/dmi.rb
CHANGED
@@ -25,57 +25,59 @@ module Ohai
|
|
25
25
|
# all-lowercase, all non-alphanumeric converted to '_'
|
26
26
|
# 128-255 are 'oem_data_[id]'
|
27
27
|
# Everything else is 'unknown'
|
28
|
-
ID_TO_DESCRIPTION
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
28
|
+
unless defined?(ID_TO_DESCRIPTION)
|
29
|
+
ID_TO_DESCRIPTION = {
|
30
|
+
0 => "bios",
|
31
|
+
1 => "system",
|
32
|
+
2 => "base_board",
|
33
|
+
3 => "chassis",
|
34
|
+
4 => "processor",
|
35
|
+
5 => "memory_controller",
|
36
|
+
6 => "memory_module",
|
37
|
+
7 => "cache",
|
38
|
+
8 => "port_connector",
|
39
|
+
9 => "system_slots",
|
40
|
+
10 => "on_board_devices",
|
41
|
+
11 => "oem_strings",
|
42
|
+
12 => "system_configuration_options",
|
43
|
+
13 => "bios_language",
|
44
|
+
14 => "group_associations",
|
45
|
+
15 => "system_event_log",
|
46
|
+
16 => "physical_memory_array",
|
47
|
+
17 => "memory_device",
|
48
|
+
18 => "32_bit_memory_error",
|
49
|
+
19 => "memory_array_mapped_address",
|
50
|
+
20 => "memory_device_mapped_address",
|
51
|
+
21 => "built_in_pointing_device",
|
52
|
+
22 => "portable_battery",
|
53
|
+
23 => "system_reset",
|
54
|
+
24 => "hardware_security",
|
55
|
+
25 => "system_power_controls",
|
56
|
+
26 => "voltage_probe",
|
57
|
+
27 => "cooling_device",
|
58
|
+
28 => "temperature_probe",
|
59
|
+
29 => "electrical_current_probe",
|
60
|
+
30 => "out_of_band_remote_access",
|
61
|
+
31 => "boot_integrity_services",
|
62
|
+
32 => "system_boot",
|
63
|
+
33 => "64_bit_memory_error",
|
64
|
+
34 => "management_device",
|
65
|
+
35 => "management_device_component",
|
66
|
+
36 => "management_device_threshold_data",
|
67
|
+
37 => "memory_channel",
|
68
|
+
38 => "ipmi_device",
|
69
|
+
39 => "power_supply",
|
70
|
+
40 => "additional_information",
|
71
|
+
41 => "onboard_devices_extended_information",
|
72
|
+
42 => "management_controller_host_interfaces",
|
73
|
+
126 => "disabled_entries",
|
74
|
+
127 => "end_of_table_marker",
|
75
|
+
}.freeze
|
76
|
+
end
|
75
77
|
|
76
78
|
# list of IDs to collect from config or default to a sane list that prunes
|
77
79
|
# away some of the less useful IDs
|
78
|
-
ID_TO_CAPTURE = [ 0, 1, 2, 3, 4, 6, 11 ].freeze
|
80
|
+
ID_TO_CAPTURE = [ 0, 1, 2, 3, 4, 6, 11 ].freeze unless defined?(ID_TO_CAPTURE)
|
79
81
|
|
80
82
|
# the allowlisted DMI IDs. This is combination of the defaults + any additional
|
81
83
|
# IDs defined in the :additional_dmi_ids config
|
@@ -116,14 +118,16 @@ module Ohai
|
|
116
118
|
id
|
117
119
|
end
|
118
120
|
|
119
|
-
SKIPPED_CONVENIENCE_KEYS
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
unless defined?(SKIPPED_CONVENIENCE_KEYS)
|
122
|
+
SKIPPED_CONVENIENCE_KEYS = %w{
|
123
|
+
application_identifier
|
124
|
+
caption
|
125
|
+
creation_class_name
|
126
|
+
size
|
127
|
+
system_creation_class_name
|
128
|
+
record_id
|
129
|
+
}.freeze
|
130
|
+
end
|
127
131
|
|
128
132
|
# create simplified convenience access keys for each record type
|
129
133
|
# for single occurrences of one type, copy to top level all fields and values
|
@@ -38,22 +38,27 @@ module Ohai
|
|
38
38
|
conn.get("/2016-01-01/#{uri}", { "User-Agent" => "chef-ohai/#{Ohai::VERSION}" })
|
39
39
|
end
|
40
40
|
|
41
|
-
def fetch_metadata(id = "")
|
41
|
+
def fetch_metadata(id = "", is_directory = true)
|
42
42
|
response = http_get(id)
|
43
43
|
return nil unless response.code == "200"
|
44
44
|
|
45
|
-
if
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
if !is_directory
|
46
|
+
if json?(response.body)
|
47
|
+
data = String(response.body)
|
48
|
+
parser = FFI_Yajl::Parser.new
|
49
|
+
parser.parse(data)
|
50
|
+
else
|
51
|
+
response.body
|
52
|
+
end
|
53
|
+
elsif is_directory
|
50
54
|
temp = {}
|
51
55
|
response.body.split("\n").each do |sub_attr|
|
52
|
-
|
56
|
+
if "#{id}/#{sub_attr}" != "/user-data"
|
57
|
+
uri = id == "" ? "#{id}#{sub_attr}/" : "#{id}#{sub_attr}"
|
58
|
+
temp[sanitize_key(sub_attr).gsub(/_$/, "")] = fetch_metadata(uri, has_trailing_slash?(uri))
|
59
|
+
end
|
53
60
|
end
|
54
61
|
temp
|
55
|
-
else
|
56
|
-
response.body
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
@@ -75,7 +80,7 @@ module Ohai
|
|
75
80
|
#
|
76
81
|
# @return [Boolean] is there a trailing /?
|
77
82
|
def has_trailing_slash?(data)
|
78
|
-
!!(
|
83
|
+
!!(data =~ %r{/$})
|
79
84
|
end
|
80
85
|
|
81
86
|
def sanitize_key(key)
|
@@ -23,10 +23,12 @@ require "socket" unless defined?(Socket)
|
|
23
23
|
module Ohai
|
24
24
|
module Mixin
|
25
25
|
module NetworkHelper
|
26
|
-
FAMILIES
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
unless defined?(FAMILIES)
|
27
|
+
FAMILIES = {
|
28
|
+
"inet" => "default",
|
29
|
+
"inet6" => "default_inet6",
|
30
|
+
}.freeze
|
31
|
+
end
|
30
32
|
|
31
33
|
def hex_to_dec_netmask(netmask)
|
32
34
|
# example 'ffff0000' -> '255.255.0.0'
|
data/lib/ohai/plugins/rpm.rb
CHANGED
@@ -22,16 +22,18 @@ Ohai.plugin(:Rpm) do
|
|
22
22
|
provides "rpm"
|
23
23
|
optional "true"
|
24
24
|
|
25
|
-
MACROS_MARKER = /========================/.freeze
|
25
|
+
MACROS_MARKER = /========================/.freeze unless defined?(MACROS_MARKER)
|
26
26
|
|
27
|
-
DO_NOT_SPLIT
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
unless defined?(DO_NOT_SPLIT)
|
28
|
+
DO_NOT_SPLIT = %w{
|
29
|
+
build_arch
|
30
|
+
build_os
|
31
|
+
install_arch
|
32
|
+
install_os
|
33
|
+
archcolor
|
34
|
+
optflags
|
35
|
+
}.freeze
|
36
|
+
end
|
35
37
|
|
36
38
|
collect_data(:aix, :darwin, :dragonflybsd, :freebsd, :linux, :netbsd, :openbsd, :solaris2) do
|
37
39
|
rpm_path = which("rpm")
|
data/lib/ohai/util/ip_helper.rb
CHANGED
@@ -21,8 +21,8 @@ module Ohai
|
|
21
21
|
require "ipaddress" unless defined?(IPAddress)
|
22
22
|
|
23
23
|
# Corresponding to RFC 4192 + RFC 4193
|
24
|
-
IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10")
|
25
|
-
IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7")
|
24
|
+
IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10") unless defined?(IPV6_LINK_LOCAL_UNICAST_BLOCK)
|
25
|
+
IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7") unless defined?(IPV6_PRIVATE_ADDRESS_BLOCK)
|
26
26
|
|
27
27
|
def private_address?(addr)
|
28
28
|
ip = IPAddress(addr)
|
data/lib/ohai/version.rb
CHANGED
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: 17.9.
|
4
|
+
version: 17.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|