ohai 16.13.0 → 16.17.2
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/plugins/linux/network.rb +85 -7
- data/lib/ohai/plugins/linux/platform.rb +11 -12
- data/lib/ohai/plugins/packages.rb +2 -1
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +2 -2
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d2f3369090412d4b03cbe4ec7cae19c4d10276d10abeb44036a98792128a5a
|
4
|
+
data.tar.gz: 7f22588951efbb2f0e0585a8ed958529cb55623cefb1ab214866b1878b6d1432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857f8cfd699d5c0fb424c34c935dab790202922dc1d76556aaf50ed7cb1d25286d8c28eb1c25f258b798a13beb6fd738da69a90f65e5fa06422e3ae71e9602ce
|
7
|
+
data.tar.gz: 7b7a2d48a1ce3a4298fe145e088609935b99adb032f414ddc1fdac968d2111ca96e1366ede4d7e3c568d166bbe6030e9181b925cc37fcf64722409a20bd9945c
|
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
|
|
3
3
|
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
# pull these gems from
|
6
|
+
# pull these gems from chef-16 of chef/chef so that we're testing against what we will release
|
7
7
|
gem "chef-config", git: "https://github.com/chef/chef", branch: "chef-16", glob: "chef-config/chef-config.gemspec"
|
8
8
|
gem "chef-utils", git: "https://github.com/chef/chef", branch: "chef-16", glob: "chef-utils/chef-utils.gemspec"
|
9
9
|
|
@@ -80,9 +80,22 @@ Ohai.plugin(:Network) do
|
|
80
80
|
line.strip!
|
81
81
|
logger.trace("Plugin Network: Parsing #{line}")
|
82
82
|
if /\\/.match?(line)
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
# If we have multipath routing, then the first part will be a normal
|
84
|
+
# looking route:
|
85
|
+
# default proto ra metric 1024 <other options>
|
86
|
+
# Each successive part after that is a hop without those options.
|
87
|
+
# So the first thing we do is grab that first part, and split it into
|
88
|
+
# the route destination ("default"), and the route options.
|
89
|
+
parts = line.split("\\")
|
90
|
+
route_dest, dest_opts = parts.first.split(nil, 2)
|
91
|
+
# Then all the route endings, generally just nexthops.
|
92
|
+
route_endings = parts[1..-1]
|
93
|
+
if dest_opts && !dest_opts.empty?
|
94
|
+
# Route options like proto, metric, etc. only appear once for each
|
95
|
+
# multipath configuration. Prepend this information to the route
|
96
|
+
# endings so the code below will assign the fields properly.
|
97
|
+
route_endings.map! { |e| e.include?("nexthop") ? "#{dest_opts} #{e}" : e }
|
98
|
+
end
|
86
99
|
elsif line =~ /^([^\s]+)\s(.*)$/
|
87
100
|
route_dest = $1
|
88
101
|
route_endings = [$2]
|
@@ -90,9 +103,24 @@ Ohai.plugin(:Network) do
|
|
90
103
|
next
|
91
104
|
end
|
92
105
|
route_endings.each do |route_ending|
|
106
|
+
route_entry = Mash.new(destination: route_dest,
|
107
|
+
family: family[:name])
|
108
|
+
route_int = nil
|
93
109
|
if route_ending =~ /\bdev\s+([^\s]+)\b/
|
94
110
|
route_int = $1
|
95
|
-
|
111
|
+
end
|
112
|
+
# does any known interface own the src address?
|
113
|
+
# we try to infer the interface/device from its address if it isn't specified
|
114
|
+
# we want to override the interface set via nexthop but only if possible
|
115
|
+
if line =~ /\bsrc\s+([^\s]+)\b/ && (!route_int || line.include?("nexthop"))
|
116
|
+
# only clobber previously set route_int if we find a match
|
117
|
+
if (match = iface.select { |name, intf| intf.fetch("addresses", {}).any? { |addr, _| addr == $1 } }.keys.first)
|
118
|
+
route_int = match
|
119
|
+
route_entry[:inferred] = true
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
unless route_int
|
96
124
|
logger.trace("Plugin Network: Skipping route entry without a device: '#{line}'")
|
97
125
|
next
|
98
126
|
end
|
@@ -103,8 +131,6 @@ Ohai.plugin(:Network) do
|
|
103
131
|
next
|
104
132
|
end
|
105
133
|
|
106
|
-
route_entry = Mash.new(destination: route_dest,
|
107
|
-
family: family[:name])
|
108
134
|
%w{via scope metric proto src}.each do |k|
|
109
135
|
# http://rubular.com/r/pwTNp65VFf
|
110
136
|
route_entry[k] = $1 if route_ending =~ /\b#{k}\s+([^\s]+)/
|
@@ -273,6 +299,30 @@ Ohai.plugin(:Network) do
|
|
273
299
|
iface
|
274
300
|
end
|
275
301
|
|
302
|
+
# determine offload features for the interface using ethtool
|
303
|
+
def ethernet_offload_parameters(iface)
|
304
|
+
return iface unless ethtool_binary_path
|
305
|
+
|
306
|
+
iface.each_key do |tmp_int|
|
307
|
+
next unless iface[tmp_int][:encapsulation] == "Ethernet"
|
308
|
+
|
309
|
+
so = shell_out("#{ethtool_binary_path} -k #{tmp_int}")
|
310
|
+
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{so.stdout}")
|
311
|
+
iface[tmp_int]["offload_params"] = {}
|
312
|
+
so.stdout.lines.each do |line|
|
313
|
+
next if line.start_with?("Features for")
|
314
|
+
next if line.strip.nil?
|
315
|
+
|
316
|
+
key, val = line.split(/:\s+/)
|
317
|
+
if val
|
318
|
+
offload_key = key.downcase.strip.tr(" ", "_").to_s
|
319
|
+
iface[tmp_int]["offload_params"][offload_key] = val.downcase.gsub(/\[.*\]/, "").strip.to_s
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
iface
|
324
|
+
end
|
325
|
+
|
276
326
|
# determine pause parameters for the interface using ethtool
|
277
327
|
def ethernet_pause_parameters(iface)
|
278
328
|
return iface unless ethtool_binary_path
|
@@ -326,6 +376,7 @@ Ohai.plugin(:Network) do
|
|
326
376
|
so = shell_out("ip -d -s link")
|
327
377
|
tmp_int = nil
|
328
378
|
on_rx = true
|
379
|
+
xdp_mode = nil
|
329
380
|
so.stdout.lines do |line|
|
330
381
|
if line =~ IPROUTE_INT_REGEX
|
331
382
|
tmp_int = $2
|
@@ -401,6 +452,30 @@ Ohai.plugin(:Network) do
|
|
401
452
|
if line =~ /\sstate (\w+)/
|
402
453
|
iface[tmp_int]["state"] = $1.downcase
|
403
454
|
end
|
455
|
+
|
456
|
+
if line.include?("xdp")
|
457
|
+
mode = line.scan(/\s(xdp|xdpgeneric|xdpoffload|xdpmulti)\s/).flatten[0]
|
458
|
+
# Fetches and sets the mode from the first line.
|
459
|
+
unless mode.nil?
|
460
|
+
iface[tmp_int][:xdp] = {}
|
461
|
+
if mode.eql?("xdp")
|
462
|
+
# In case of xdpdrv, mode is xdp,
|
463
|
+
# to keep it consistent, keeping mode as xdpdrv.
|
464
|
+
mode = "xdpdrv"
|
465
|
+
end
|
466
|
+
xdp_mode = mode
|
467
|
+
iface[tmp_int][:xdp][:attached] = []
|
468
|
+
end
|
469
|
+
|
470
|
+
if line =~ %r{prog/(\w+) id (\d+) tag (\w+)}
|
471
|
+
mode = $1.eql?("xdp") ? xdp_mode : $1
|
472
|
+
iface[tmp_int][:xdp][:attached] << {
|
473
|
+
mode: mode,
|
474
|
+
id: $2,
|
475
|
+
tag: $3,
|
476
|
+
}
|
477
|
+
end
|
478
|
+
end
|
404
479
|
end
|
405
480
|
iface
|
406
481
|
end
|
@@ -583,10 +658,12 @@ Ohai.plugin(:Network) do
|
|
583
658
|
# sorting the selected routes:
|
584
659
|
# - getting default routes first
|
585
660
|
# - then sort by metric
|
661
|
+
# - then sort by if the device was inferred or not (preferring explicit to inferred)
|
586
662
|
# - then by prefixlen
|
587
663
|
[
|
588
664
|
r[:destination] == "default" ? 0 : 1,
|
589
665
|
r[:metric].nil? ? 0 : r[:metric].to_i,
|
666
|
+
r[:inferred] ? 1 : 0,
|
590
667
|
# for some reason IPAddress doesn't accept "::/0", it doesn't like prefix==0
|
591
668
|
# just a quick workaround: use 0 if IPAddress fails
|
592
669
|
begin
|
@@ -793,9 +870,10 @@ Ohai.plugin(:Network) do
|
|
793
870
|
iface = ethernet_ring_parameters(iface)
|
794
871
|
iface = ethernet_channel_parameters(iface)
|
795
872
|
iface = ethernet_coalesce_parameters(iface)
|
873
|
+
iface = ethernet_offload_parameters(iface)
|
796
874
|
iface = ethernet_driver_info(iface)
|
797
875
|
iface = ethernet_pause_parameters(iface)
|
798
876
|
counters[:network][:interfaces] = net_counters
|
799
877
|
network["interfaces"] = iface
|
800
878
|
end
|
801
|
-
end
|
879
|
+
end
|
@@ -54,7 +54,7 @@ Ohai.plugin(:Platform) do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
#
|
57
|
-
# Cached /etc/os-release info Hash.
|
57
|
+
# Cached /etc/os-release info Hash. Also has logic for Cisco Nexus
|
58
58
|
# switches that pulls the chained CISCO_RELEASE_INFO file into the Hash (other
|
59
59
|
# distros can also reuse this method safely).
|
60
60
|
#
|
@@ -122,7 +122,7 @@ Ohai.plugin(:Platform) do
|
|
122
122
|
"sles_sap" => "suse",
|
123
123
|
"sles" => "suse",
|
124
124
|
"xenenterprise" => "xenserver",
|
125
|
-
}[id] || id
|
125
|
+
}[id.downcase] || id.downcase
|
126
126
|
end
|
127
127
|
|
128
128
|
#
|
@@ -134,20 +134,22 @@ Ohai.plugin(:Platform) do
|
|
134
134
|
#
|
135
135
|
def platform_family_from_platform(plat)
|
136
136
|
case plat
|
137
|
-
when /
|
137
|
+
when /ubuntu/, /debian/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
|
138
138
|
# apt-get+dpkg almost certainly goes here
|
139
139
|
"debian"
|
140
|
-
when /
|
140
|
+
when /centos/, /redhat/, /oracle/, /almalinux/, /rocky/, /scientific/, /enterpriseenterprise/, /xenserver/, /xcp-ng/, /cloudlinux/, /alibabalinux/, /sangoma/, /clearos/, /parallels/, /ibm_powerkvm/, /nexus_centos/, /bigip/, /virtuozzo/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
|
141
141
|
# NOTE: "rhel" should be reserved exclusively for recompiled rhel versions that are nearly perfectly compatible down to the platform_version.
|
142
142
|
# The operating systems that are "rhel" should all be as compatible as rhel7 = centos7 = oracle7 = scientific7 (98%-ish core RPM version compatibility
|
143
143
|
# and the version numbers MUST track the upstream). The appropriate EPEL version repo should work nearly perfectly. Some variation like the
|
144
|
-
# oracle kernel version differences and tuning and extra packages are clearly acceptable.
|
145
|
-
# should not be in this list.
|
144
|
+
# oracle kernel version differences and tuning and extra packages are clearly acceptable. Almost certainly some distros above (xenserver?)
|
145
|
+
# should not be in this list. Please use fedora, below, instead. Also note that this is the only platform_family with this strict of a rule,
|
146
146
|
# see the example of the debian platform family for how the rest of the platform_family designations should be used.
|
147
|
+
#
|
148
|
+
# TODO: when XCP-NG 7.4 support ends we can remove the xcp-ng match. 7.5+ reports as xenenterprise which we remap to xenserver
|
147
149
|
"rhel"
|
148
150
|
when /amazon/
|
149
151
|
"amazon"
|
150
|
-
when /suse/, /sles/, /
|
152
|
+
when /suse/, /sles/, /opensuseleap/, /opensuse/, /sled/
|
151
153
|
"suse"
|
152
154
|
when /fedora/, /pidora/, /arista_eos/
|
153
155
|
# In the broadest sense: RPM-based, fedora-derived distributions which are not strictly re-compiled RHEL (if it uses RPMs, and smells more like redhat and less like
|
@@ -157,8 +159,6 @@ Ohai.plugin(:Platform) do
|
|
157
159
|
"wrlinux"
|
158
160
|
when /gentoo/
|
159
161
|
"gentoo"
|
160
|
-
when /slackware/
|
161
|
-
"slackware"
|
162
162
|
when /arch/, /manjaro/, /antergos/
|
163
163
|
"arch"
|
164
164
|
when /exherbo/
|
@@ -169,6 +169,8 @@ Ohai.plugin(:Platform) do
|
|
169
169
|
"clearlinux"
|
170
170
|
when /mangeia/
|
171
171
|
"mandriva"
|
172
|
+
when /slackware/
|
173
|
+
"slackware"
|
172
174
|
end
|
173
175
|
end
|
174
176
|
|
@@ -271,9 +273,6 @@ Ohai.plugin(:Platform) do
|
|
271
273
|
elsif /XenServer/i.match?(lsb[:id])
|
272
274
|
platform "xenserver"
|
273
275
|
platform_version lsb[:release]
|
274
|
-
elsif /XCP/i.match?(lsb[:id])
|
275
|
-
platform "xcp"
|
276
|
-
platform_version lsb[:release]
|
277
276
|
elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties
|
278
277
|
platform lsb[:id].downcase
|
279
278
|
platform_version lsb[:release]
|
@@ -134,8 +134,9 @@ Ohai.plugin(:Packages) do
|
|
134
134
|
require "win32/registry" unless defined?(Win32::Registry)
|
135
135
|
packages Mash.new
|
136
136
|
collect_programs_from_registry_key(Win32::Registry::HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall')
|
137
|
-
|
137
|
+
# on 64 bit systems, 32 bit programs are stored here moved before HKEY_CURRENT_USER otherwise it is not collected (impacts both ohai 16 & 17)
|
138
138
|
collect_programs_from_registry_key(Win32::Registry::HKEY_LOCAL_MACHINE, 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
|
139
|
+
collect_programs_from_registry_key(Win32::Registry::HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Uninstall') rescue nil
|
139
140
|
# on 64 bit systems, 32 bit programs are stored here
|
140
141
|
end
|
141
142
|
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.required_ruby_version = ">= 2.6"
|
16
16
|
|
17
|
-
s.add_dependency "chef-config", ">= 12
|
17
|
+
s.add_dependency "chef-config", ">= 14.12", "< 17"
|
18
18
|
s.add_dependency "chef-utils", ">= 16.0", "< 17"
|
19
19
|
s.add_dependency "ffi", "~> 1.9"
|
20
20
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency "mixlib-cli", ">= 1.7.0" # 1.7+ needed to support passing multiple options
|
23
23
|
s.add_dependency "mixlib-config", ">= 2.0", "< 4.0"
|
24
24
|
s.add_dependency "mixlib-log", ">= 2.0.1", "< 4.0"
|
25
|
-
s.add_dependency "mixlib-shellout", "
|
25
|
+
s.add_dependency "mixlib-shellout", "~> 3.2", ">= 3.2.5"
|
26
26
|
s.add_dependency "plist", "~> 3.1"
|
27
27
|
s.add_dependency "train-core"
|
28
28
|
s.add_dependency "wmi-lite", "~> 1.0"
|
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: 16.
|
4
|
+
version: 16.17.2
|
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-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '12
|
19
|
+
version: '14.12'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '17'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '12
|
29
|
+
version: '14.12'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '17'
|
@@ -150,22 +150,22 @@ dependencies:
|
|
150
150
|
name: mixlib-shellout
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: '2
|
156
|
-
- - "
|
155
|
+
version: '3.2'
|
156
|
+
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
158
|
+
version: 3.2.5
|
159
159
|
type: :runtime
|
160
160
|
prerelease: false
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- - "
|
163
|
+
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '2
|
166
|
-
- - "
|
165
|
+
version: '3.2'
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: 3.2.5
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: plist
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|