ohai 17.0.42 → 17.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -5
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +26 -4
- data/lib/ohai/plugins/linux/livepatch.rb +38 -0
- data/lib/ohai/plugins/linux/network.rb +1 -1
- data/lib/ohai/plugins/linux/platform.rb +1 -1
- data/lib/ohai/plugins/linux/tc.rb +61 -0
- data/lib/ohai/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98c016d2839114bfe15deee549cf97ba8ff627ab2931207a105a42a154746cc7
|
4
|
+
data.tar.gz: '06687f5ca824b9489e3140b19415ae8c99e1afefc053d9c4519b4d7af9d85cf8'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a8b2890b42b09e33d01a67ff589f587029d052a7a55a2ba09d1f2dd482afce275201e06cf968492f0645b8273f9b69890c7f082af878883ee66bc615828a96a
|
7
|
+
data.tar.gz: 3de0474524e3e9825e74f645630fc9e721f2ddbecd2a16bb337a21a02fa25d25cab469a5a810e8e2461ed137aab78f03abde064887993f64c784399b0ab8bdd9
|
data/Gemfile
CHANGED
@@ -3,20 +3,20 @@ 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 main of chef/chef so that we're testing against what we will release
|
7
|
+
gem "chef-config", git: "https://github.com/chef/chef", branch: "main", glob: "chef-config/chef-config.gemspec"
|
8
|
+
gem "chef-utils", git: "https://github.com/chef/chef", branch: "main", 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
|
12
|
-
gem "chefstyle",
|
12
|
+
gem "chefstyle", "2.1.0"
|
13
13
|
gem "ipaddr_extensions"
|
14
14
|
gem "rake", ">= 10.1.0"
|
15
15
|
gem "rspec-collection_matchers", "~> 1.0"
|
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.11.5"
|
20
20
|
gem "rubocop-rspec"
|
21
21
|
end
|
22
22
|
|
data/lib/ohai/config.rb
CHANGED
@@ -26,7 +26,7 @@ module Ohai
|
|
26
26
|
Config = ChefConfig::Config
|
27
27
|
|
28
28
|
# Reopens ChefConfig::Config to add Ohai configuration settings.
|
29
|
-
# see: https://github.com/chef/chef/blob/
|
29
|
+
# see: https://github.com/chef/chef/blob/main/lib/chef/config.rb
|
30
30
|
class Config
|
31
31
|
config_context :ohai do
|
32
32
|
default :disabled_plugins, []
|
@@ -41,10 +41,32 @@ module Ohai
|
|
41
41
|
module Ec2Metadata
|
42
42
|
|
43
43
|
EC2_METADATA_ADDR ||= "169.254.169.254"
|
44
|
-
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0
|
45
|
+
2007-01-19
|
46
|
+
2007-03-01
|
47
|
+
2007-08-29
|
48
|
+
2007-10-10
|
49
|
+
2007-12-15
|
50
|
+
2008-02-01
|
51
|
+
2008-09-01
|
52
|
+
2009-04-04
|
53
|
+
2011-01-01
|
54
|
+
2011-05-01
|
55
|
+
2012-01-12
|
56
|
+
2014-02-25
|
57
|
+
2014-11-05
|
58
|
+
2015-10-20
|
59
|
+
2016-04-19
|
60
|
+
2016-06-30
|
61
|
+
2016-09-02
|
62
|
+
2018-03-28
|
63
|
+
2018-08-17
|
64
|
+
2018-09-24
|
65
|
+
2019-10-01
|
66
|
+
2020-10-27
|
67
|
+
2021-01-03
|
68
|
+
2021-03-23
|
69
|
+
2021-07-15 }.freeze
|
48
70
|
EC2_ARRAY_VALUES ||= %w{security-groups local_ipv4s}.freeze
|
49
71
|
EC2_ARRAY_DIR ||= %w{network/interfaces/macs}.freeze
|
50
72
|
EC2_JSON_DIR ||= %w{iam}.freeze
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Author:: Song Liu <song@kernel.org>
|
4
|
+
# Copyright:: Copyright (c) 2021 Facebook, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
Ohai.plugin(:Livepatch) do
|
21
|
+
provides "livepatch"
|
22
|
+
|
23
|
+
collect_data(:linux) do
|
24
|
+
if file_exist?("/sys/kernel/livepatch")
|
25
|
+
patches = Mash.new
|
26
|
+
dir_glob("/sys/kernel/livepatch/*").each do |livepatch_dir|
|
27
|
+
dir = File.basename(livepatch_dir)
|
28
|
+
patches[dir] = Mash.new
|
29
|
+
%w{enabled transition}.each do |check|
|
30
|
+
if file_exist?("/sys/kernel/livepatch/#{dir}/#{check}")
|
31
|
+
file_open("/sys/kernel/livepatch/#{dir}/#{check}") { |f| patches[dir][check] = f.read_nonblock(1024).strip }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
livepatch patches
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -80,7 +80,7 @@ Ohai.plugin(:Network) do
|
|
80
80
|
line.strip!
|
81
81
|
logger.trace("Plugin Network: Parsing #{line}")
|
82
82
|
if /\\/.match?(line)
|
83
|
-
parts = line.split(
|
83
|
+
parts = line.split("\\")
|
84
84
|
route_dest = parts.shift.strip
|
85
85
|
route_endings = parts
|
86
86
|
elsif line =~ /^([^\s]+)\s(.*)$/
|
@@ -137,7 +137,7 @@ Ohai.plugin(:Platform) do
|
|
137
137
|
when /ubuntu/, /debian/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
|
138
138
|
# apt-get+dpkg almost certainly goes here
|
139
139
|
"debian"
|
140
|
-
when /centos/, /redhat/, /oracle/, /almalinux/, /scientific/, /enterpriseenterprise/, /xenserver/, /xcp-ng/, /cloudlinux/, /alibabalinux/, /sangoma/, /clearos/, /parallels/, /ibm_powerkvm/, /nexus_centos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
|
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
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matthew Massey <matthewmassey@fb.com>
|
3
|
+
# Copyright:: Copyright (c) 2021 Facebook
|
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
|
+
Ohai.plugin(:Tc) do
|
20
|
+
provides "tc"
|
21
|
+
optional true
|
22
|
+
|
23
|
+
collect_data(:linux) do
|
24
|
+
tc_path = which("tc")
|
25
|
+
if tc_path
|
26
|
+
cmd = "#{tc_path} qdisc show"
|
27
|
+
tc_output = shell_out(cmd)
|
28
|
+
|
29
|
+
tc_data = Mash.new
|
30
|
+
tc_data[:qdisc] = Mash.new
|
31
|
+
|
32
|
+
tc_output.stdout.split("\n").each do |line|
|
33
|
+
line = line.strip
|
34
|
+
if /dev (\w+)/ =~ line
|
35
|
+
dev = $1
|
36
|
+
tc_data[:qdisc][dev] ||= Mash.new
|
37
|
+
else
|
38
|
+
next
|
39
|
+
end
|
40
|
+
if /qdisc (\w+)/ =~ line
|
41
|
+
qdisc = $1
|
42
|
+
tc_data[:qdisc][dev][:qdiscs] ||= []
|
43
|
+
tc_data[:qdisc][dev][:qdiscs] << Mash.new
|
44
|
+
qdisc_idx = tc_data[:qdisc][dev][:qdiscs].length - 1
|
45
|
+
tc_data[:qdisc][dev][:qdiscs][qdisc_idx] ||= Mash.new
|
46
|
+
tc_data[:qdisc][dev][:qdiscs][qdisc_idx][:type] = qdisc
|
47
|
+
tc_data[:qdisc][dev][:qdiscs][qdisc_idx][:parms] ||= Mash.new
|
48
|
+
else
|
49
|
+
next
|
50
|
+
end
|
51
|
+
if qdisc == "fq" && /buckets (\d+)/ =~ line
|
52
|
+
buckets = $1.to_i
|
53
|
+
tc_data[:qdisc][dev][:qdiscs][qdisc_idx][:parms][:buckets] = buckets
|
54
|
+
end
|
55
|
+
end
|
56
|
+
tc tc_data
|
57
|
+
else
|
58
|
+
logger.trace("Plugin Tc: Could not find tc. Skipping plugin.")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
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.0
|
4
|
+
version: 17.6.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: 2021-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- lib/ohai/plugins/linux/hostnamectl.rb
|
303
303
|
- lib/ohai/plugins/linux/interrupts.rb
|
304
304
|
- lib/ohai/plugins/linux/ipc.rb
|
305
|
+
- lib/ohai/plugins/linux/livepatch.rb
|
305
306
|
- lib/ohai/plugins/linux/lsb.rb
|
306
307
|
- lib/ohai/plugins/linux/lspci.rb
|
307
308
|
- lib/ohai/plugins/linux/machineid.rb
|
@@ -314,6 +315,7 @@ files:
|
|
314
315
|
- lib/ohai/plugins/linux/sessions.rb
|
315
316
|
- lib/ohai/plugins/linux/sysctl.rb
|
316
317
|
- lib/ohai/plugins/linux/systemd_paths.rb
|
318
|
+
- lib/ohai/plugins/linux/tc.rb
|
317
319
|
- lib/ohai/plugins/linux/virtualization.rb
|
318
320
|
- lib/ohai/plugins/lua.rb
|
319
321
|
- lib/ohai/plugins/mono.rb
|