ohai 16.13.0 → 17.5.2
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.
- checksums.yaml +4 -4
- data/Gemfile +5 -5
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/mixin/alibaba_metadata.rb +86 -0
- data/lib/ohai/mixin/ec2_metadata.rb +26 -4
- data/lib/ohai/plugins/aix/virtualization.rb +4 -3
- data/lib/ohai/plugins/alibaba.rb +72 -0
- data/lib/ohai/plugins/c.rb +6 -8
- data/lib/ohai/plugins/cloud.rb +20 -3
- data/lib/ohai/plugins/cpu.rb +245 -34
- data/lib/ohai/plugins/filesystem.rb +4 -17
- data/lib/ohai/plugins/habitat.rb +73 -0
- data/lib/ohai/plugins/hostname.rb +22 -1
- data/lib/ohai/plugins/linux/livepatch.rb +38 -0
- data/lib/ohai/plugins/linux/network.rb +30 -5
- data/lib/ohai/plugins/linux/platform.rb +13 -14
- data/lib/ohai/plugins/linux/virtualization.rb +35 -1
- data/lib/ohai/plugins/network.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +4 -8
- metadata +21 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afaf1b3332e2a31c5d045ea50e9315bd9fcf64fcd21e120982974c5b9d167d76
|
|
4
|
+
data.tar.gz: ed90edfe09e2bf83fea9018b7f16d3fd16caf28aa998e75e44c9980789df6d30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4693d375412563df16856fe88ccdfd83ba5279a9b33fb3856ea9a7299bc599c943d7360d7135d28a59543420456a250300ad416a5e93bb7b09f7041750c336c
|
|
7
|
+
data.tar.gz: ee963b18a46ea9b8a2d3292be0f82a2aaa7ef90cb629a71eb1fe51a661b5ded47d8da4c9b44f35614d169b6e0922dba3aa5e966ceab7055dcef8e57b50fc7afa
|
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.0.9"
|
|
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, []
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software 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
|
+
require "net/http" unless defined?(Net::HTTP)
|
|
20
|
+
|
|
21
|
+
module Ohai
|
|
22
|
+
module Mixin
|
|
23
|
+
#
|
|
24
|
+
# This code parses the Alibaba Instance Metadata API to provide details
|
|
25
|
+
# of the running instance.
|
|
26
|
+
#
|
|
27
|
+
# Note: As of 2021-02-07 there is only one API release so we're not implementing
|
|
28
|
+
# logic like the ec2 or azure mixins where we have to find the latest supported
|
|
29
|
+
# release
|
|
30
|
+
module AlibabaMetadata
|
|
31
|
+
|
|
32
|
+
ALI_METADATA_ADDR ||= "100.100.100.200"
|
|
33
|
+
|
|
34
|
+
def http_get(uri)
|
|
35
|
+
conn = Net::HTTP.start(ALI_METADATA_ADDR)
|
|
36
|
+
conn.read_timeout = 6
|
|
37
|
+
conn.keep_alive_timeout = 6
|
|
38
|
+
conn.get("/2016-01-01/#{uri}", { "User-Agent" => "chef-ohai/#{Ohai::VERSION}" })
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def fetch_metadata(id = "")
|
|
42
|
+
response = http_get(id)
|
|
43
|
+
return nil unless response.code == "200"
|
|
44
|
+
|
|
45
|
+
if json?(response.body)
|
|
46
|
+
data = String(response.body)
|
|
47
|
+
parser = FFI_Yajl::Parser.new
|
|
48
|
+
parser.parse(data)
|
|
49
|
+
elsif response.body.include?("\n")
|
|
50
|
+
temp = {}
|
|
51
|
+
response.body.split("\n").each do |sub_attr|
|
|
52
|
+
temp[sanitize_key(sub_attr)] = fetch_metadata("#{id}/#{sub_attr}")
|
|
53
|
+
end
|
|
54
|
+
temp
|
|
55
|
+
else
|
|
56
|
+
response.body
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# @param [String] data that might be JSON
|
|
61
|
+
#
|
|
62
|
+
# @return [Boolean] is the data JSON or not?
|
|
63
|
+
def json?(data)
|
|
64
|
+
data = String(data)
|
|
65
|
+
parser = FFI_Yajl::Parser.new
|
|
66
|
+
begin
|
|
67
|
+
parser.parse(data)
|
|
68
|
+
true
|
|
69
|
+
rescue FFI_Yajl::ParseError
|
|
70
|
+
false
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# @param data [String]
|
|
75
|
+
#
|
|
76
|
+
# @return [Boolean] is there a trailing /?
|
|
77
|
+
def has_trailing_slash?(data)
|
|
78
|
+
!!( data =~ %r{/$} )
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def sanitize_key(key)
|
|
82
|
+
key.gsub(%r{\-|/}, "_")
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -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
|
|
@@ -24,14 +24,15 @@ Ohai.plugin(:Virtualization) do
|
|
|
24
24
|
virtualization Mash.new
|
|
25
25
|
|
|
26
26
|
lpar_no, lpar_name = shell_out("uname -L").stdout.split(nil, 2)
|
|
27
|
+
lpar_no = lpar_no.to_i
|
|
27
28
|
|
|
28
|
-
unless lpar_no
|
|
29
|
+
unless lpar_no == -1 || (lpar_no == 1 && lpar_name == "NULL")
|
|
29
30
|
virtualization[:lpar_no] = lpar_no
|
|
30
31
|
virtualization[:lpar_name] = lpar_name
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
wpar_no = shell_out("uname -W").stdout.strip
|
|
34
|
-
if wpar_no
|
|
34
|
+
wpar_no = shell_out("uname -W").stdout.strip.to_i
|
|
35
|
+
if wpar_no > 0
|
|
35
36
|
virtualization[:wpar_no] = wpar_no
|
|
36
37
|
else
|
|
37
38
|
# the below parses the output of lswpar in the long format
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software 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
|
+
# How we detect Alibaba from easiest to hardest & least reliable
|
|
20
|
+
# 1. Ohai alibaba hint exists. This always works
|
|
21
|
+
# 2. DMI sys_vendor data mentions alibaba.
|
|
22
|
+
|
|
23
|
+
Ohai.plugin(:Alibaba) do
|
|
24
|
+
require_relative "../mixin/alibaba_metadata"
|
|
25
|
+
require_relative "../mixin/http_helper"
|
|
26
|
+
|
|
27
|
+
include Ohai::Mixin::AlibabaMetadata
|
|
28
|
+
include Ohai::Mixin::HttpHelper
|
|
29
|
+
|
|
30
|
+
provides "alibaba"
|
|
31
|
+
|
|
32
|
+
# look for alibaba string in dmi sys_vendor data within the sys tree.
|
|
33
|
+
# this works even if the system lacks dmidecode use by the Dmi plugin
|
|
34
|
+
# @return [Boolean] do we have Alibaba DMI data?
|
|
35
|
+
def has_ali_dmi?
|
|
36
|
+
if /Alibaba/.match?(file_val_if_exists("/sys/class/dmi/id/sys_vendor"))
|
|
37
|
+
logger.trace("Plugin Alibaba: has_ali_dmi? == true")
|
|
38
|
+
true
|
|
39
|
+
else
|
|
40
|
+
logger.trace("Plugin Alibaba: has_ali_dmi? == false")
|
|
41
|
+
false
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# return the contents of a file if the file exists
|
|
46
|
+
# @param path[String] abs path to the file
|
|
47
|
+
# @return [String] contents of the file if it exists
|
|
48
|
+
def file_val_if_exists(path)
|
|
49
|
+
if file_exist?(path)
|
|
50
|
+
file_read(path)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# a single check that combines all the various detection methods for Alibaba
|
|
55
|
+
# @return [Boolean] Does the system appear to be on Alibaba
|
|
56
|
+
def looks_like_alibaba?
|
|
57
|
+
return true if hint?("alibaba") || has_ali_dmi?
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
collect_data do
|
|
61
|
+
if looks_like_alibaba?
|
|
62
|
+
logger.trace("Plugin Alibaba: looks_like_alibaba? == true")
|
|
63
|
+
alibaba Mash.new
|
|
64
|
+
fetch_metadata.each do |k, v|
|
|
65
|
+
alibaba[k] = v
|
|
66
|
+
end
|
|
67
|
+
else
|
|
68
|
+
logger.trace("Plugin Alibaba: looks_like_alibaba? == false")
|
|
69
|
+
false
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
data/lib/ohai/plugins/c.rb
CHANGED
|
@@ -85,14 +85,12 @@ Ohai.plugin(:C) do
|
|
|
85
85
|
|
|
86
86
|
def collect_glibc
|
|
87
87
|
# glibc
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@c[:glibc][:description] = description
|
|
95
|
-
end
|
|
88
|
+
collect("ldd --version") do |so|
|
|
89
|
+
description = so.stdout.split($/).first
|
|
90
|
+
if description =~ /(\d+\.\d+\.?\d*)/
|
|
91
|
+
@c[:glibc] = Mash.new
|
|
92
|
+
@c[:glibc][:version] = $1
|
|
93
|
+
@c[:glibc][:description] = description
|
|
96
94
|
end
|
|
97
95
|
end
|
|
98
96
|
end
|
data/lib/ohai/plugins/cloud.rb
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
Ohai.plugin(:Cloud) do
|
|
19
19
|
provides "cloud"
|
|
20
20
|
|
|
21
|
+
depends "alibaba"
|
|
21
22
|
depends "ec2"
|
|
22
23
|
depends "gce"
|
|
23
24
|
depends "rackspace"
|
|
@@ -118,7 +119,22 @@ Ohai.plugin(:Cloud) do
|
|
|
118
119
|
end
|
|
119
120
|
end
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
#--------------------------------------
|
|
123
|
+
# Alibaba Cloud
|
|
124
|
+
#--------------------------------------
|
|
125
|
+
|
|
126
|
+
def on_alibaba?
|
|
127
|
+
alibaba != nil
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def get_alibaba_values
|
|
131
|
+
@cloud_attr_obj.add_ipv4_addr(alibaba["meta_data"]["eipv4"], :public)
|
|
132
|
+
@cloud_attr_obj.add_ipv4_addr(alibaba["meta_data"]["private_ipv4"], :private)
|
|
133
|
+
@cloud_attr_obj.local_hostname = alibaba["meta_data"]["hostname"]
|
|
134
|
+
@cloud_attr_obj.provider = "alibaba"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#--------------------------------------
|
|
122
138
|
# Google Compute Engine (gce)
|
|
123
139
|
#--------------------------------------
|
|
124
140
|
|
|
@@ -133,9 +149,9 @@ Ohai.plugin(:Cloud) do
|
|
|
133
149
|
end
|
|
134
150
|
end.flatten.compact
|
|
135
151
|
|
|
136
|
-
private_ips = gce["instance"]["networkInterfaces"].
|
|
152
|
+
private_ips = gce["instance"]["networkInterfaces"].filter_map do |interface|
|
|
137
153
|
interface["ip"]
|
|
138
|
-
end
|
|
154
|
+
end
|
|
139
155
|
|
|
140
156
|
public_ips.each { |ipaddr| @cloud_attr_obj.add_ipv4_addr(ipaddr, :public) }
|
|
141
157
|
private_ips.each { |ipaddr| @cloud_attr_obj.add_ipv4_addr(ipaddr, :private) }
|
|
@@ -334,6 +350,7 @@ Ohai.plugin(:Cloud) do
|
|
|
334
350
|
get_azure_values if on_azure?
|
|
335
351
|
get_digital_ocean_values if on_digital_ocean?
|
|
336
352
|
get_softlayer_values if on_softlayer?
|
|
353
|
+
get_alibaba_values if on_alibaba?
|
|
337
354
|
|
|
338
355
|
cloud @cloud_attr_obj.cloud_mash
|
|
339
356
|
end
|
data/lib/ohai/plugins/cpu.rb
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
|
10
10
|
# Author:: Isa Farnik (<isa@chef.io>)
|
|
11
11
|
# Author:: Doug MacEachern <dougm@vmware.com>
|
|
12
|
+
# Author:: Lance Albertson <lance@osuosl.org>
|
|
12
13
|
# Copyright:: Copyright (c) Chef Software Inc.
|
|
13
14
|
# License:: Apache License, Version 2.0
|
|
14
15
|
#
|
|
@@ -46,13 +47,213 @@ Ohai.plugin(:CPU) do
|
|
|
46
47
|
cpuinfo
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
# Convert a string that looks like range of CPUs to an array
|
|
51
|
+
# Given the following range: 1-7
|
|
52
|
+
# Convert it into an array: [1, 2, 3, 4, 5, 6, 7]
|
|
53
|
+
def range_str_to_a(range)
|
|
54
|
+
range.split(",").each_with_object([]) do |cpu, arr|
|
|
55
|
+
if /\d+-\d+/.match?(cpu.to_s)
|
|
56
|
+
arr << Range.new(*cpu.split("-").map(&:to_i)).to_a
|
|
57
|
+
else
|
|
58
|
+
arr << cpu.to_i
|
|
59
|
+
end
|
|
60
|
+
end.flatten
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def parse_lscpu(cpu_info)
|
|
64
|
+
lscpu_info = Mash.new
|
|
65
|
+
begin
|
|
66
|
+
so = shell_out("lscpu")
|
|
67
|
+
cpu_cores = shell_out("lscpu -p=CPU,CORE,SOCKET")
|
|
68
|
+
if so.exitstatus == 0 && cpu_cores.exitstatus == 0
|
|
69
|
+
lscpu_info[:numa_node_cpus] = Mash.new
|
|
70
|
+
lscpu_info[:vulnerability] = Mash.new
|
|
71
|
+
so.stdout.each_line do |line|
|
|
72
|
+
case line
|
|
73
|
+
when /^Architecture:\s+(.+)/
|
|
74
|
+
lscpu_info[:architecture] = $1.to_s
|
|
75
|
+
when /^CPU op-mode\(s\):\s+(.+)/
|
|
76
|
+
lscpu_info[:cpu_opmodes] = $1.split(", ")
|
|
77
|
+
when /^Byte Order:\s+(.+)/
|
|
78
|
+
lscpu_info[:byte_order] = $1.downcase
|
|
79
|
+
when /^Address sizes:\s+(.+)/
|
|
80
|
+
lscpu_info[:address_sizes] = $1.split(", ")
|
|
81
|
+
when /^CPU\(s\):\s+(.+)/
|
|
82
|
+
lscpu_info[:cpus] = $1.to_i
|
|
83
|
+
when /^On-line CPU\(s\) list:\s+(.+)/
|
|
84
|
+
cpu_range = range_str_to_a($1)
|
|
85
|
+
if cpu_range == [0]
|
|
86
|
+
lscpu_info[:cpus_online] = 0
|
|
87
|
+
else
|
|
88
|
+
lscpu_info[:cpus_online] = cpu_range.length
|
|
89
|
+
end
|
|
90
|
+
when /^Off-line CPU\(s\) list:\s+(.+)/
|
|
91
|
+
cpu_range = range_str_to_a($1)
|
|
92
|
+
if cpu_range == [0]
|
|
93
|
+
lscpu_info[:cpus_offline] = 0
|
|
94
|
+
else
|
|
95
|
+
lscpu_info[:cpus_offline] = cpu_range.length
|
|
96
|
+
end
|
|
97
|
+
when /^Thread\(s\) per core:\s+(.+)/ # http://rubular.com/r/lOw2pRrw1q
|
|
98
|
+
lscpu_info[:threads_per_core] = $1.to_i
|
|
99
|
+
when /^Core\(s\) per socket:\s+(.+)/ # http://rubular.com/r/lOw2pRrw1q
|
|
100
|
+
lscpu_info[:cores_per_socket] = $1.to_i
|
|
101
|
+
when /^Socket\(s\):\s+(.+)/ # http://rubular.com/r/DIzmPtJFvK
|
|
102
|
+
lscpu_info[:sockets] = $1.to_i
|
|
103
|
+
when /^Socket\(s\) per book:\s+(.+)/
|
|
104
|
+
lscpu_info[:sockets_per_book] = $1.to_i
|
|
105
|
+
when /^Book\(s\) per drawer:\s+(.+)/
|
|
106
|
+
lscpu_info[:books_per_drawer] = $1.to_i
|
|
107
|
+
when /^Drawer\(s\):\s+(.+)/
|
|
108
|
+
lscpu_info[:drawers] = $1.to_i
|
|
109
|
+
when /^NUMA node\(s\):\s+(.+)/
|
|
110
|
+
lscpu_info[:numa_nodes] = $1.to_i
|
|
111
|
+
when /^Vendor ID:\s+(.+)/
|
|
112
|
+
lscpu_info[:vendor_id] = $1
|
|
113
|
+
when /^Machine type:\s+(.+)/
|
|
114
|
+
lscpu_info[:machine_type] = $1
|
|
115
|
+
when /^CPU family:\s+(.+)/
|
|
116
|
+
lscpu_info[:family] = $1
|
|
117
|
+
when /^Model:\s+(.+)/
|
|
118
|
+
lscpu_info[:model] = $1
|
|
119
|
+
when /^Model name:\s+(.+)/
|
|
120
|
+
lscpu_info[:model_name] = $1
|
|
121
|
+
when /^Stepping:\s+(.+)/
|
|
122
|
+
lscpu_info[:stepping] = $1
|
|
123
|
+
when /^CPU MHz:\s+(.+)/
|
|
124
|
+
lscpu_info[:mhz] = $1
|
|
125
|
+
when /^CPU static MHz:\s+(.+)/
|
|
126
|
+
lscpu_info[:mhz] = $1
|
|
127
|
+
when /^CPU max MHz:\s+(.+)/
|
|
128
|
+
lscpu_info[:mhz_max] = $1
|
|
129
|
+
when /^CPU min MHz:\s+(.+)/
|
|
130
|
+
lscpu_info[:mhz_min] = $1
|
|
131
|
+
when /^CPU dynamic MHz:\s+(.+)/
|
|
132
|
+
lscpu_info[:mhz_dynamic] = $1
|
|
133
|
+
when /^BogoMIPS:\s+(.+)/
|
|
134
|
+
lscpu_info[:bogomips] = $1
|
|
135
|
+
when /^Virtualization:\s+(.+)/
|
|
136
|
+
lscpu_info[:virtualization] = $1
|
|
137
|
+
when /^Virtualization type:\s+(.+)/
|
|
138
|
+
lscpu_info[:virtualization_type] = $1
|
|
139
|
+
when /^Hypervisor vendor:\s+(.+)/
|
|
140
|
+
lscpu_info[:hypervisor_vendor] = $1
|
|
141
|
+
when /^Dispatching mode:\s+(.+)/
|
|
142
|
+
lscpu_info[:dispatching_mode] = $1
|
|
143
|
+
when /^L1d cache:\s+(.+)/
|
|
144
|
+
lscpu_info[:l1d_cache] = $1
|
|
145
|
+
when /^L1i cache:\s+(.+)/
|
|
146
|
+
lscpu_info[:l1i_cache] = $1
|
|
147
|
+
when /^L2 cache:\s+(.+)/
|
|
148
|
+
lscpu_info[:l2_cache] = $1
|
|
149
|
+
when /^L2d cache:\s+(.+)/
|
|
150
|
+
lscpu_info[:l2d_cache] = $1
|
|
151
|
+
when /^L2i cache:\s+(.+)/
|
|
152
|
+
lscpu_info[:l2i_cache] = $1
|
|
153
|
+
when /^L3 cache:\s+(.+)/
|
|
154
|
+
lscpu_info[:l3_cache] = $1
|
|
155
|
+
when /^L4 cache:\s+(.+)/
|
|
156
|
+
lscpu_info[:l4_cache] = $1
|
|
157
|
+
when /^NUMA node(\d+) CPU\(s\):\s+(.+)/
|
|
158
|
+
numa_node = $1
|
|
159
|
+
cpus = $2
|
|
160
|
+
lscpu_info[:numa_node_cpus][numa_node] = range_str_to_a(cpus)
|
|
161
|
+
when /^Vulnerability (.+?):\s+(.+)/ # https://rubular.com/r/aKtSD1ypUlKbGm
|
|
162
|
+
name = $1.strip.downcase.tr(" ", "_")
|
|
163
|
+
description = $2.strip
|
|
164
|
+
lscpu_info[:vulnerability][name] = Mash.new
|
|
165
|
+
lscpu_info[:vulnerability][name] = description
|
|
166
|
+
when /^Flags:\s+(.+)/
|
|
167
|
+
lscpu_info[:flags] = $1.split(" ").sort
|
|
168
|
+
# flags are "features" on aarch64 and s390x so add it for backwards computability
|
|
169
|
+
lscpu_info[:features] = lscpu_info[:flags] if lscpu_info[:architecture].match?(/aarch64|s390x/)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
case lscpu_info[:architecture]
|
|
174
|
+
when "s390x"
|
|
175
|
+
# Add data from /proc/cpuinfo that isn't available from lscpu
|
|
176
|
+
lscpu_info[:bogomips_per_cpu] = cpu_info[:bogomips_per_cpu]
|
|
177
|
+
lscpu_info[:version] = cpu_info["0"][:version]
|
|
178
|
+
lscpu_info[:identification] = cpu_info["0"][:identification]
|
|
179
|
+
lscpu_info[:machine] = cpu_info["0"][:machine]
|
|
180
|
+
lscpu_total = lscpu_info[:sockets_per_book] * lscpu_info[:cores_per_socket] * lscpu_info[:threads_per_core] * lscpu_info[:books_per_drawer] * lscpu_info[:drawers]
|
|
181
|
+
lscpu_real = lscpu_info[:sockets_per_book]
|
|
182
|
+
lscpu_cores = lscpu_info[:sockets_per_book] * lscpu_info[:cores_per_socket] * lscpu_info[:books_per_drawer] * lscpu_info[:drawers]
|
|
183
|
+
when "ppc64le"
|
|
184
|
+
# Add data from /proc/cpuinfo that isn't available from lscpu
|
|
185
|
+
lscpu_info[:timebase] = cpu_info[:timebase]
|
|
186
|
+
lscpu_info[:platform] = cpu_info[:platform]
|
|
187
|
+
lscpu_info[:machine_model] = cpu_info[:machine_model]
|
|
188
|
+
lscpu_info[:machine] = cpu_info[:machine]
|
|
189
|
+
lscpu_info[:firmware] = cpu_info[:firmware] if cpu_info[:firmware]
|
|
190
|
+
lscpu_info[:mmu] = cpu_info[:mmu] if cpu_info[:mmu]
|
|
191
|
+
lscpu_info[:mhz] = cpu_info["0"][:mhz]
|
|
192
|
+
lscpu_total = lscpu_info[:sockets] * lscpu_info[:cores_per_socket] * lscpu_info[:threads_per_core]
|
|
193
|
+
lscpu_real = lscpu_info[:sockets]
|
|
194
|
+
lscpu_cores = lscpu_info[:sockets] * lscpu_info[:cores_per_socket]
|
|
195
|
+
else
|
|
196
|
+
lscpu_total = lscpu_info[:sockets] * lscpu_info[:cores_per_socket] * lscpu_info[:threads_per_core]
|
|
197
|
+
lscpu_real = lscpu_info[:sockets]
|
|
198
|
+
lscpu_cores = lscpu_info[:sockets] * lscpu_info[:cores_per_socket]
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Enumerate cpus and fill out data to provide backwards compatibility data
|
|
202
|
+
cpu_cores.stdout.each_line do |line|
|
|
203
|
+
current_cpu = nil
|
|
204
|
+
current_core = nil
|
|
205
|
+
current_socket = nil
|
|
206
|
+
|
|
207
|
+
case line
|
|
208
|
+
# skip comments
|
|
209
|
+
when /^#/
|
|
210
|
+
next
|
|
211
|
+
# Parse data from "lscpu -p=CPU,CORE,SOCKET"
|
|
212
|
+
when /(\d+),(\d+),(\d+)/
|
|
213
|
+
current_cpu = $1
|
|
214
|
+
current_core = $2
|
|
215
|
+
current_socket = $3
|
|
216
|
+
end
|
|
217
|
+
lscpu_info[current_cpu] = Mash.new
|
|
218
|
+
lscpu_info[current_cpu][:vendor_id] = lscpu_info[:vendor_id] if lscpu_info[:vendor_id]
|
|
219
|
+
lscpu_info[current_cpu][:family] = lscpu_info[:family] if lscpu_info[:family]
|
|
220
|
+
lscpu_info[current_cpu][:model] = lscpu_info[:model] if lscpu_info[:model]
|
|
221
|
+
lscpu_info[current_cpu][:model_name] = lscpu_info[:model_name] if lscpu_info[:model_name]
|
|
222
|
+
lscpu_info[current_cpu][:stepping] = lscpu_info[:stepping] if lscpu_info[:stepping]
|
|
223
|
+
lscpu_info[current_cpu][:mhz] = lscpu_info[:mhz] if lscpu_info[:mhz]
|
|
224
|
+
lscpu_info[current_cpu][:bogomips] = lscpu_info[:bogomips] if lscpu_info[:bogomips]
|
|
225
|
+
# Per cpu cache_size is only really available from /proc/cpuinfo on x86
|
|
226
|
+
lscpu_info[current_cpu][:cache_size] = cpu_info[current_cpu][:cache_size] if cpu_info[current_cpu] && cpu_info[current_cpu][:cache_size]
|
|
227
|
+
lscpu_info[current_cpu][:physical_id] = current_socket
|
|
228
|
+
lscpu_info[current_cpu][:core_id] = current_core
|
|
229
|
+
lscpu_info[current_cpu][:cores] = lscpu_info[:cores_per_socket].to_s
|
|
230
|
+
lscpu_info[current_cpu][:flags] = lscpu_info[:flags] if lscpu_info[:flags]
|
|
231
|
+
lscpu_info[current_cpu][:features] = lscpu_info[:flags] if lscpu_info[:architecture].match?(/aarch64|s390x/)
|
|
232
|
+
if lscpu_info[:architecture] == "s390x"
|
|
233
|
+
lscpu_info[current_cpu][:version] = cpu_info[current_cpu][:version] if cpu_info[current_cpu][:version]
|
|
234
|
+
lscpu_info[current_cpu][:identification] = cpu_info[current_cpu][:identification] if cpu_info[current_cpu][:identification]
|
|
235
|
+
lscpu_info[current_cpu][:machine] = cpu_info[current_cpu][:machine] if cpu_info[current_cpu][:machine]
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
lscpu_info[:total] = lscpu_total
|
|
239
|
+
lscpu_info[:real] = lscpu_real
|
|
240
|
+
lscpu_info[:cores] = lscpu_cores
|
|
241
|
+
else
|
|
242
|
+
logger.trace("Plugin CPU: Error executing lscpu. CPU data may not be available.")
|
|
243
|
+
end
|
|
244
|
+
rescue Ohai::Exceptions::Exec # util-linux isn't installed most likely
|
|
245
|
+
logger.trace("Plugin CPU: Error executing lscpu. util-linux may not be installed.")
|
|
246
|
+
end
|
|
247
|
+
lscpu_info
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def parse_cpuinfo
|
|
50
251
|
cpuinfo = Mash.new
|
|
51
252
|
real_cpu = Mash.new
|
|
52
253
|
cpu_number = 0
|
|
53
254
|
current_cpu = nil
|
|
54
255
|
|
|
55
|
-
file_open("/proc/cpuinfo").
|
|
256
|
+
file_open("/proc/cpuinfo").each_line do |line|
|
|
56
257
|
case line
|
|
57
258
|
when /processor\s+:\s(.+)/
|
|
58
259
|
cpuinfo[$1] = Mash.new
|
|
@@ -68,7 +269,11 @@ Ohai.plugin(:CPU) do
|
|
|
68
269
|
when /cpu family\s+:\s(.+)/
|
|
69
270
|
cpuinfo[current_cpu]["family"] = $1
|
|
70
271
|
when /model\s+:\s(.+)/
|
|
71
|
-
|
|
272
|
+
model = $1
|
|
273
|
+
cpuinfo[current_cpu]["model"] = model
|
|
274
|
+
# ppc has "model" at the end of /proc/cpuinfo. In addition it should always include a include a dash or "IBM".
|
|
275
|
+
# So let's put this in cpu/model on ppc
|
|
276
|
+
cpuinfo["machine_model"] = model if model.match?(/-|IBM/)
|
|
72
277
|
when /stepping\s+:\s(.+)/
|
|
73
278
|
cpuinfo[current_cpu]["stepping"] = $1
|
|
74
279
|
when /physical id\s+:\s(.+)/
|
|
@@ -94,6 +299,24 @@ Ohai.plugin(:CPU) do
|
|
|
94
299
|
cpuinfo["bogomips_per_cpu"] = $1
|
|
95
300
|
when /features\s+:\s(.+)/
|
|
96
301
|
cpuinfo["features"] = $1.split
|
|
302
|
+
# ppc64le
|
|
303
|
+
when /revision\s+:\s(.+)/
|
|
304
|
+
cpuinfo[current_cpu]["model"] = $1
|
|
305
|
+
when /cpu\s+:\s(.+)/
|
|
306
|
+
cpuinfo[current_cpu]["model_name"] = $1
|
|
307
|
+
when /clock\s+:\s(.+)/
|
|
308
|
+
cpuinfo[current_cpu]["mhz"] = $1
|
|
309
|
+
when /timebase\s+:\s(.+)/
|
|
310
|
+
cpuinfo["timebase"] = $1
|
|
311
|
+
when /platform\s+:\s(.+)/
|
|
312
|
+
cpuinfo["platform"] = $1
|
|
313
|
+
when /machine\s+:\s(.+)/
|
|
314
|
+
cpuinfo["machine"] = $1
|
|
315
|
+
when /firmware\s+:\s(.+)/
|
|
316
|
+
cpuinfo["firmware"] = $1
|
|
317
|
+
when /MMU\s+:\s(.+)/
|
|
318
|
+
cpuinfo["mmu"] = $1
|
|
319
|
+
# s390x
|
|
97
320
|
when /processor\s(\d):\s(.+)/
|
|
98
321
|
current_cpu = $1
|
|
99
322
|
cpu_number += 1
|
|
@@ -108,40 +331,28 @@ Ohai.plugin(:CPU) do
|
|
|
108
331
|
end
|
|
109
332
|
end
|
|
110
333
|
|
|
111
|
-
cpu cpuinfo
|
|
112
|
-
|
|
113
|
-
cpu[:total] = cpu_number
|
|
114
|
-
|
|
115
334
|
# use data we collected unless cpuinfo is lacking core information
|
|
116
335
|
# which is the case on older linux distros
|
|
117
|
-
if !real_cpu.empty? &&
|
|
118
|
-
|
|
119
|
-
|
|
336
|
+
if !real_cpu.empty? && cpuinfo["0"]["cores"]
|
|
337
|
+
logger.trace("Plugin CPU: Error executing lscpu. CPU data may not be available.")
|
|
338
|
+
cpuinfo[:real] = real_cpu.keys.length
|
|
339
|
+
cpuinfo[:cores] = real_cpu.keys.length * cpuinfo["0"]["cores"].to_i
|
|
120
340
|
else
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
cpu[:total] = lscpu_data[:sockets] * lscpu_data[:cores] * lscpu_data[:threads]
|
|
137
|
-
cpu[:real] = lscpu_data[:sockets]
|
|
138
|
-
cpu[:cores] = lscpu_data[:sockets] * lscpu_data[:cores]
|
|
139
|
-
else
|
|
140
|
-
logger.trace("Plugin CPU: Error executing lscpu. CPU data may not be available.")
|
|
141
|
-
end
|
|
142
|
-
rescue Ohai::Exceptions::Exec # util-linux isn't installed most likely
|
|
143
|
-
logger.trace("Plugin CPU: Error executing lscpu. util-linux may not be installed.")
|
|
144
|
-
end
|
|
341
|
+
logger.trace("Plugin CPU: real cpu & core data is missing in /proc/cpuinfo and lscpu")
|
|
342
|
+
end
|
|
343
|
+
cpuinfo[:total] = cpu_number
|
|
344
|
+
cpuinfo
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
collect_data(:linux) do
|
|
348
|
+
cpuinfo = parse_cpuinfo
|
|
349
|
+
lscpu = parse_lscpu(cpuinfo)
|
|
350
|
+
|
|
351
|
+
# If we don't have any data from lscpu then get it from /proc/cpuinfo
|
|
352
|
+
if lscpu.empty?
|
|
353
|
+
cpu cpuinfo
|
|
354
|
+
else
|
|
355
|
+
cpu lscpu
|
|
145
356
|
end
|
|
146
357
|
end
|
|
147
358
|
|
|
@@ -98,14 +98,6 @@ Ohai.plugin(:Filesystem) do
|
|
|
98
98
|
view
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
-
def generate_deprecated_windows_view(fs)
|
|
102
|
-
view = generate_mountpoint_view(fs)
|
|
103
|
-
view.each do |mp, entry|
|
|
104
|
-
view[mp].delete("devices")
|
|
105
|
-
end
|
|
106
|
-
view
|
|
107
|
-
end
|
|
108
|
-
|
|
109
101
|
def parse_common_df(out)
|
|
110
102
|
fs = {}
|
|
111
103
|
out.each_line do |line|
|
|
@@ -466,9 +458,7 @@ Ohai.plugin(:Filesystem) do
|
|
|
466
458
|
fs_data["by_mountpoint"] = by_mountpoint
|
|
467
459
|
fs_data["by_pair"] = by_pair
|
|
468
460
|
|
|
469
|
-
# @todo in Chef 17 the filesystem2 part of this goes away
|
|
470
461
|
filesystem fs_data
|
|
471
|
-
filesystem2 fs_data
|
|
472
462
|
end
|
|
473
463
|
|
|
474
464
|
collect_data(:darwin) do
|
|
@@ -613,9 +603,7 @@ Ohai.plugin(:Filesystem) do
|
|
|
613
603
|
fs_data["by_mountpoint"] = by_mountpoint
|
|
614
604
|
fs_data["by_pair"] = by_pair
|
|
615
605
|
|
|
616
|
-
# @todo in Chef 17 the filesystem2 plugin goes away
|
|
617
606
|
filesystem fs_data
|
|
618
|
-
filesystem2 fs_data
|
|
619
607
|
end
|
|
620
608
|
|
|
621
609
|
collect_data(:aix) do
|
|
@@ -705,9 +693,7 @@ Ohai.plugin(:Filesystem) do
|
|
|
705
693
|
fs_data["by_mountpoint"] = by_mountpoint
|
|
706
694
|
fs_data["by_pair"] = by_pair
|
|
707
695
|
|
|
708
|
-
# @todo in Chef 17 the filesystem2 plugin goes away here
|
|
709
696
|
filesystem fs_data
|
|
710
|
-
filesystem2 fs_data
|
|
711
697
|
end
|
|
712
698
|
|
|
713
699
|
collect_data(:windows) do
|
|
@@ -726,9 +712,10 @@ Ohai.plugin(:Filesystem) do
|
|
|
726
712
|
fs_data["by_mountpoint"] = by_mountpoint
|
|
727
713
|
fs_data["by_pair"] = by_pair
|
|
728
714
|
|
|
729
|
-
#
|
|
730
|
-
#
|
|
731
|
-
|
|
715
|
+
# Chef 16 added 'filesystem2'
|
|
716
|
+
# In Chef 17 we made 'filesystem' and 'filesystem2' match (both new-style)
|
|
717
|
+
# In Chef 18 we will drop 'filesystem2'
|
|
718
|
+
filesystem fs_data
|
|
732
719
|
filesystem2 fs_data
|
|
733
720
|
end
|
|
734
721
|
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
#
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
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(:Habitat) do
|
|
20
|
+
provides "habitat"
|
|
21
|
+
|
|
22
|
+
def habitat_binary
|
|
23
|
+
@habitat_binary ||= which("hab")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def fetch_habitat_version
|
|
27
|
+
shell_out([habitat_binary, "-V"]).stdout.gsub(/hab\s*/, "").strip
|
|
28
|
+
rescue Ohai::Exceptions::Exec
|
|
29
|
+
logger.trace("Plugin Habitat: Unable to determine the installed version of Habitat, skipping collection.")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def fetch_habitat_packages
|
|
33
|
+
shell_out([habitat_binary, "pkg", "list", "--all"]).stdout.split.sort.select { |pkg| pkg.match?(%r{.*/.*/.*/.*}) }
|
|
34
|
+
rescue Ohai::Exceptions::Exec
|
|
35
|
+
logger.trace("Plugin Habitat: Unable to determine the installed Habitat packages, skipping collection.")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def load_habitat_service_via_cli(status_stdout)
|
|
39
|
+
# package type desired state elapsed (s) pid group
|
|
40
|
+
# core/httpd/2.4.35/20190307151146 standalone up up 158169 1410 httpd.default
|
|
41
|
+
@services = []
|
|
42
|
+
status_stdout.each_line do |line|
|
|
43
|
+
fields = line.split(/\s+/)
|
|
44
|
+
next unless fields[0].match?(%r{.*/.*/.*/.*}) # ignore header line
|
|
45
|
+
|
|
46
|
+
service = {}
|
|
47
|
+
service[:identity] = fields[0]
|
|
48
|
+
service[:topology] = fields[1]
|
|
49
|
+
service[:state_desired] = fields[2]
|
|
50
|
+
service[:state_actual] = fields[2]
|
|
51
|
+
(@services).push(service)
|
|
52
|
+
end
|
|
53
|
+
@services
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def fetch_habitat_services
|
|
57
|
+
services_shell_out = shell_out([habitat_binary, "svc", "status"]).stdout
|
|
58
|
+
load_habitat_service_via_cli(services_shell_out) if services_shell_out
|
|
59
|
+
rescue Ohai::Exceptions::Exec
|
|
60
|
+
logger.trace("Plugin Habitat: Unable to determine the installed Habitat services, skipping collection.")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
collect_data(:default) do
|
|
64
|
+
if habitat_binary
|
|
65
|
+
habitat Mash.new
|
|
66
|
+
habitat["version"] = fetch_habitat_version
|
|
67
|
+
habitat["packages"] = fetch_habitat_packages
|
|
68
|
+
habitat["services"] = fetch_habitat_services
|
|
69
|
+
else
|
|
70
|
+
logger.trace("Plugin Habitat: Could not find hab binary. Skipping plugin.")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -48,7 +48,28 @@ Ohai.plugin(:Hostname) do
|
|
|
48
48
|
require "ipaddr" unless defined?(IPAddr)
|
|
49
49
|
|
|
50
50
|
hostname = from_cmd("hostname")
|
|
51
|
-
|
|
51
|
+
begin
|
|
52
|
+
addrinfo = Socket.getaddrinfo(hostname, nil).first
|
|
53
|
+
rescue SocketError
|
|
54
|
+
# In the event that we got an exception from Socket, it's possible
|
|
55
|
+
# that it will work if we restrict it to IPv4 only either because of
|
|
56
|
+
# IPv6 misconfiguration or other bugs.
|
|
57
|
+
#
|
|
58
|
+
# Specifically it's worth noting that on macOS, getaddrinfo() will choke
|
|
59
|
+
# if it gets back a link-local address (say if you have 'fe80::1 myhost'
|
|
60
|
+
# in /etc/hosts). This will raise:
|
|
61
|
+
# SocketError (getnameinfo: Non-recoverable failure in name resolution)
|
|
62
|
+
#
|
|
63
|
+
# But general misconfiguration could cause similar issues, so attempt to
|
|
64
|
+
# fall back to v4-only
|
|
65
|
+
begin
|
|
66
|
+
addrinfo = Socket.getaddrinfo(hostname, nil, :INET).first
|
|
67
|
+
rescue
|
|
68
|
+
# and if *that* fails, then try v6-only, in case we're in a v6-only
|
|
69
|
+
# environment with v4 config issues
|
|
70
|
+
addrinfo = Socket.getaddrinfo(hostname, nil, :INET6).first
|
|
71
|
+
end
|
|
72
|
+
end
|
|
52
73
|
iaddr = IPAddr.new(addrinfo[3])
|
|
53
74
|
Socket.gethostbyaddr(iaddr.hton)[0]
|
|
54
75
|
rescue
|
|
@@ -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(.*)$/
|
|
@@ -141,13 +141,13 @@ Ohai.plugin(:Network) do
|
|
|
141
141
|
|
|
142
142
|
# using a temporary var to hold routes and their interface name
|
|
143
143
|
def parse_routes(family, iface)
|
|
144
|
-
iface.
|
|
144
|
+
iface.filter_map do |i, iv|
|
|
145
145
|
next unless iv[:routes]
|
|
146
146
|
|
|
147
|
-
iv[:routes].
|
|
147
|
+
iv[:routes].filter_map do |r|
|
|
148
148
|
r.merge(dev: i) if r[:family] == family[:name]
|
|
149
|
-
end
|
|
150
|
-
end.
|
|
149
|
+
end
|
|
150
|
+
end.flatten
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
# determine layer 1 details for the interface using ethtool
|
|
@@ -273,6 +273,30 @@ Ohai.plugin(:Network) do
|
|
|
273
273
|
iface
|
|
274
274
|
end
|
|
275
275
|
|
|
276
|
+
# determine offload features for the interface using ethtool
|
|
277
|
+
def ethernet_offload_parameters(iface)
|
|
278
|
+
return iface unless ethtool_binary_path
|
|
279
|
+
|
|
280
|
+
iface.each_key do |tmp_int|
|
|
281
|
+
next unless iface[tmp_int][:encapsulation] == "Ethernet"
|
|
282
|
+
|
|
283
|
+
so = shell_out("#{ethtool_binary_path} -k #{tmp_int}")
|
|
284
|
+
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{so.stdout}")
|
|
285
|
+
iface[tmp_int]["offload_params"] = {}
|
|
286
|
+
so.stdout.lines.each do |line|
|
|
287
|
+
next if line.start_with?("Features for")
|
|
288
|
+
next if line.strip.nil?
|
|
289
|
+
|
|
290
|
+
key, val = line.split(/:\s+/)
|
|
291
|
+
if val
|
|
292
|
+
offload_key = key.downcase.strip.tr(" ", "_").to_s
|
|
293
|
+
iface[tmp_int]["offload_params"][offload_key] = val.downcase.gsub(/\[.*\]/, "").strip.to_s
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
iface
|
|
298
|
+
end
|
|
299
|
+
|
|
276
300
|
# determine pause parameters for the interface using ethtool
|
|
277
301
|
def ethernet_pause_parameters(iface)
|
|
278
302
|
return iface unless ethtool_binary_path
|
|
@@ -793,6 +817,7 @@ Ohai.plugin(:Network) do
|
|
|
793
817
|
iface = ethernet_ring_parameters(iface)
|
|
794
818
|
iface = ethernet_channel_parameters(iface)
|
|
795
819
|
iface = ethernet_coalesce_parameters(iface)
|
|
820
|
+
iface = ethernet_offload_parameters(iface)
|
|
796
821
|
iface = ethernet_driver_info(iface)
|
|
797
822
|
iface = ethernet_pause_parameters(iface)
|
|
798
823
|
counters[:network][:interfaces] = net_counters
|
|
@@ -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,22 +134,24 @@ 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
|
-
when /fedora/, /
|
|
154
|
+
when /fedora/, /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
|
|
154
156
|
# SuSE it probably goes here).
|
|
155
157
|
"fedora"
|
|
@@ -157,9 +159,7 @@ Ohai.plugin(:Platform) do
|
|
|
157
159
|
"wrlinux"
|
|
158
160
|
when /gentoo/
|
|
159
161
|
"gentoo"
|
|
160
|
-
when /
|
|
161
|
-
"slackware"
|
|
162
|
-
when /arch/, /manjaro/, /antergos/
|
|
162
|
+
when /arch/, /manjaro/
|
|
163
163
|
"arch"
|
|
164
164
|
when /exherbo/
|
|
165
165
|
"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]
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Ohai.plugin(:Virtualization) do
|
|
21
21
|
provides "virtualization"
|
|
22
22
|
depends "dmi"
|
|
23
|
+
depends "cpu"
|
|
23
24
|
require_relative "../../mixin/dmi_decode"
|
|
24
25
|
include Ohai::Mixin::DmiDecode
|
|
25
26
|
|
|
@@ -35,6 +36,10 @@ Ohai.plugin(:Virtualization) do
|
|
|
35
36
|
which("docker")
|
|
36
37
|
end
|
|
37
38
|
|
|
39
|
+
def podman_exists?
|
|
40
|
+
which("podman")
|
|
41
|
+
end
|
|
42
|
+
|
|
38
43
|
collect_data(:linux) do
|
|
39
44
|
virtualization Mash.new unless virtualization
|
|
40
45
|
virtualization[:systems] ||= Mash.new
|
|
@@ -46,6 +51,13 @@ Ohai.plugin(:Virtualization) do
|
|
|
46
51
|
virtualization[:systems][:docker] = "host"
|
|
47
52
|
end
|
|
48
53
|
|
|
54
|
+
# Podman hosts
|
|
55
|
+
if podman_exists?
|
|
56
|
+
virtualization[:system] = "podman"
|
|
57
|
+
virtualization[:role] = "host"
|
|
58
|
+
virtualization[:systems][:podman] = "host"
|
|
59
|
+
end
|
|
60
|
+
|
|
49
61
|
# Xen Notes:
|
|
50
62
|
# - /proc/xen is an empty dir for EL6 + Linode Guests + Paravirt EC2 instances
|
|
51
63
|
# - cpuid of guests, if we could get it, would also be a clue
|
|
@@ -115,6 +127,14 @@ Ohai.plugin(:Virtualization) do
|
|
|
115
127
|
virtualization[:role] = "host"
|
|
116
128
|
virtualization[:systems][:kvm] = "host"
|
|
117
129
|
end
|
|
130
|
+
elsif get_attribute(:cpu, :hypervisor_vendor)
|
|
131
|
+
if get_attribute(:cpu, :hypervisor_vendor) == "KVM"
|
|
132
|
+
virtualization[:system] = "kvm"
|
|
133
|
+
if /(para|full)/.match?(get_attribute(:cpu, :virtualization_type))
|
|
134
|
+
virtualization[:role] = "guest"
|
|
135
|
+
virtualization[:systems][:kvm] = "guest"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
118
138
|
end
|
|
119
139
|
|
|
120
140
|
# parse dmi to discover various virtualization guests
|
|
@@ -188,7 +208,7 @@ Ohai.plugin(:Virtualization) do
|
|
|
188
208
|
# <index #>:<subsystem>:/
|
|
189
209
|
#
|
|
190
210
|
# Full notes, https://tickets.opscode.com/browse/OHAI-551
|
|
191
|
-
# Kernel docs, https://www.kernel.org/doc/Documentation/cgroups
|
|
211
|
+
# Kernel docs, https://web.archive.org/web/20100514070914/http://www.kernel.org/doc/Documentation/cgroups/
|
|
192
212
|
if file_exist?("/proc/self/cgroup")
|
|
193
213
|
cgroup_content = file_read("/proc/self/cgroup")
|
|
194
214
|
# These two REs catch many different examples. Here's a specific one
|
|
@@ -210,6 +230,20 @@ Ohai.plugin(:Virtualization) do
|
|
|
210
230
|
virtualization[:system] = "nspawn"
|
|
211
231
|
virtualization[:role] = "guest"
|
|
212
232
|
virtualization[:systems][:nspawn] = "guest"
|
|
233
|
+
elsif /container=podman/.match?(file_read("/proc/1/environ"))
|
|
234
|
+
logger.trace("Plugin Virtualization: /proc/1/environ indicates podman container. Detecting as podman guest")
|
|
235
|
+
virtualization[:system] = "podman"
|
|
236
|
+
virtualization[:role] = "guest"
|
|
237
|
+
virtualization[:systems][:podman] = "guest"
|
|
238
|
+
# Detect any containers that appear to be using docker such as those running on Github Actions virtual machines
|
|
239
|
+
# but aren't triggered by the cgroup regex above. It's pretty safe to assume if the cgroup contains containerd,
|
|
240
|
+
# it's likely using docker.
|
|
241
|
+
# https://rubular.com/r/qhSmV113cPmEBT
|
|
242
|
+
elsif %r{^\d+:[^:]*:/[^/]+/(containerd)-?.+$}.match?(cgroup_content)
|
|
243
|
+
logger.trace("Plugin Virtualization: /proc/self/cgroup indicates docker container. Detecting as docker guest")
|
|
244
|
+
virtualization[:system] = "docker"
|
|
245
|
+
virtualization[:role] = "guest"
|
|
246
|
+
virtualization[:systems][:docker] = "guest"
|
|
213
247
|
elsif lxc_version_exists? && file_read("/proc/self/cgroup") =~ %r{\d:[^:]+:/$}
|
|
214
248
|
# lxc-version shouldn't be installed by default
|
|
215
249
|
# Even so, it is likely we are on an LXC capable host that is not being used as such
|
data/lib/ohai/plugins/network.rb
CHANGED
|
@@ -82,7 +82,7 @@ Ohai.plugin(:NetworkAddresses) do
|
|
|
82
82
|
elsif network[gw_attr] &&
|
|
83
83
|
network["interfaces"][network[int_attr]] &&
|
|
84
84
|
network["interfaces"][network[int_attr]]["addresses"]
|
|
85
|
-
if [ "0.0.0.0", "::", /^fe80:/ ].any? { |pat| pat === network[gw_attr] }
|
|
85
|
+
if [ "0.0.0.0", "::", /^fe80:/ ].any? { |pat| pat === network[gw_attr] } # rubocop: disable Performance/RedundantEqualityComparisonBlock
|
|
86
86
|
# link level default route
|
|
87
87
|
logger.trace("Plugin Network: link level default #{family} route, picking ip from #{network[gw_attr]}")
|
|
88
88
|
r = gw_if_ips.first
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
|
@@ -12,24 +12,20 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.email = "adam@chef.io"
|
|
13
13
|
s.homepage = "https://github.com/chef/ohai/"
|
|
14
14
|
|
|
15
|
-
s.required_ruby_version = ">= 2.
|
|
15
|
+
s.required_ruby_version = ">= 2.7"
|
|
16
16
|
|
|
17
|
-
s.add_dependency "chef-config", ">= 12
|
|
18
|
-
s.add_dependency "chef-utils", ">= 16.0", "<
|
|
17
|
+
s.add_dependency "chef-config", ">= 14.12", "< 18"
|
|
18
|
+
s.add_dependency "chef-utils", ">= 16.0", "< 18"
|
|
19
19
|
s.add_dependency "ffi", "~> 1.9"
|
|
20
20
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
|
21
21
|
s.add_dependency "ipaddress"
|
|
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"
|
|
29
|
-
# Note for ohai developers: If chef-config causes you grief, try:
|
|
30
|
-
# bundle install --with development
|
|
31
|
-
# this should work as long as chef is a development dependency in Gemfile.
|
|
32
|
-
#
|
|
33
29
|
|
|
34
30
|
s.bindir = "bin"
|
|
35
31
|
s.executables = %w{ohai}
|
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:
|
|
4
|
+
version: 17.5.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: 2021-
|
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chef-config
|
|
@@ -16,20 +16,20 @@ 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
|
-
version: '
|
|
22
|
+
version: '18'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
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
|
-
version: '
|
|
32
|
+
version: '18'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: chef-utils
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: '16.0'
|
|
40
40
|
- - "<"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '
|
|
42
|
+
version: '18'
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +49,7 @@ dependencies:
|
|
|
49
49
|
version: '16.0'
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
52
|
+
version: '18'
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: ffi
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -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
|
|
@@ -230,6 +230,7 @@ files:
|
|
|
230
230
|
- lib/ohai/loader.rb
|
|
231
231
|
- lib/ohai/log.rb
|
|
232
232
|
- lib/ohai/mash.rb
|
|
233
|
+
- lib/ohai/mixin/alibaba_metadata.rb
|
|
233
234
|
- lib/ohai/mixin/azure_metadata.rb
|
|
234
235
|
- lib/ohai/mixin/chef_utils_wiring.rb
|
|
235
236
|
- lib/ohai/mixin/command.rb
|
|
@@ -255,6 +256,7 @@ files:
|
|
|
255
256
|
- lib/ohai/plugins/aix/platform.rb
|
|
256
257
|
- lib/ohai/plugins/aix/uptime.rb
|
|
257
258
|
- lib/ohai/plugins/aix/virtualization.rb
|
|
259
|
+
- lib/ohai/plugins/alibaba.rb
|
|
258
260
|
- lib/ohai/plugins/azure.rb
|
|
259
261
|
- lib/ohai/plugins/bsd/virtualization.rb
|
|
260
262
|
- lib/ohai/plugins/c.rb
|
|
@@ -286,6 +288,7 @@ files:
|
|
|
286
288
|
- lib/ohai/plugins/go.rb
|
|
287
289
|
- lib/ohai/plugins/groovy.rb
|
|
288
290
|
- lib/ohai/plugins/grub2.rb
|
|
291
|
+
- lib/ohai/plugins/habitat.rb
|
|
289
292
|
- lib/ohai/plugins/haskell.rb
|
|
290
293
|
- lib/ohai/plugins/hostname.rb
|
|
291
294
|
- lib/ohai/plugins/init_package.rb
|
|
@@ -299,6 +302,7 @@ files:
|
|
|
299
302
|
- lib/ohai/plugins/linux/hostnamectl.rb
|
|
300
303
|
- lib/ohai/plugins/linux/interrupts.rb
|
|
301
304
|
- lib/ohai/plugins/linux/ipc.rb
|
|
305
|
+
- lib/ohai/plugins/linux/livepatch.rb
|
|
302
306
|
- lib/ohai/plugins/linux/lsb.rb
|
|
303
307
|
- lib/ohai/plugins/linux/lspci.rb
|
|
304
308
|
- lib/ohai/plugins/linux/machineid.rb
|
|
@@ -385,7 +389,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
385
389
|
requirements:
|
|
386
390
|
- - ">="
|
|
387
391
|
- !ruby/object:Gem::Version
|
|
388
|
-
version: '2.
|
|
392
|
+
version: '2.7'
|
|
389
393
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
394
|
requirements:
|
|
391
395
|
- - ">="
|