ohai 16.10.6 → 16.17.0
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/chef.rb +11 -0
- data/lib/ohai/plugins/eucalyptus.rb +1 -1
- data/lib/ohai/plugins/linux/os_release.rb +38 -0
- data/lib/ohai/plugins/linux/platform.rb +17 -17
- data/lib/ohai/plugins/linux/virtualization.rb +5 -1
- data/lib/ohai/plugins/packages.rb +6 -4
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +2 -2
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85428f5d6833cf43857b50380c5c4987462ef9af9176844387bfef5e6ebb2c6f
|
4
|
+
data.tar.gz: dead65d1c8914398e76e32db45b510f2f614ff6e24b21f7bd311811890fc778c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebdae2428922df53dab47f38786a70d81a196fa9f773ace33a624257f3af8b6ae49c6f6aa56112a363c4fe9f716b757c4491af7cd45f9dc9b73320f5130a8ab6
|
7
|
+
data.tar.gz: 164e7f850b0040fe46176ead6387f580d6ed881671a3c842a5f4b4d518363ed7335747c555f39ab704c684b9d63b4336ca77d3e90ddbc4928a35ae99600667a9
|
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
|
|
data/lib/ohai/plugins/chef.rb
CHANGED
@@ -20,9 +20,19 @@
|
|
20
20
|
Ohai.plugin(:Chef) do
|
21
21
|
provides "chef_packages/chef"
|
22
22
|
|
23
|
+
def chef_effortless?
|
24
|
+
# Determine if client is being run as a Habitat package.
|
25
|
+
if Chef::CHEF_ROOT.include?("hab/pkgs/chef/chef")
|
26
|
+
# Determine if client is running in zero mode which would show it is using the Effortless pattern.
|
27
|
+
# Explicitly set response to true or nil, not false
|
28
|
+
ChefConfig::Config["chef_server_url"].include?("chefzero://")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
collect_data(:default, :target) do
|
24
33
|
begin
|
25
34
|
require "chef/version"
|
35
|
+
require "chef-config/config" unless defined?(ChefConfig::Config)
|
26
36
|
rescue Gem::LoadError
|
27
37
|
logger.trace("Plugin Chef: Unable to load the chef gem to determine the version")
|
28
38
|
# this catches when you've done a major version bump of ohai, but
|
@@ -35,5 +45,6 @@ Ohai.plugin(:Chef) do
|
|
35
45
|
chef_packages[:chef] = Mash.new
|
36
46
|
chef_packages[:chef][:version] = Chef::VERSION
|
37
47
|
chef_packages[:chef][:chef_root] = Chef::CHEF_ROOT
|
48
|
+
chef_packages[:chef][:chef_effortless] = chef_effortless?
|
38
49
|
end
|
39
50
|
end
|
@@ -29,7 +29,7 @@ Ohai.plugin(:Eucalyptus) do
|
|
29
29
|
provides "eucalyptus"
|
30
30
|
depends "network/interfaces"
|
31
31
|
|
32
|
-
MAC_MATCH = /^[dD]0:0[dD]:/.freeze
|
32
|
+
MAC_MATCH = /^[dD]0:0[dD]:/.freeze unless defined?(MAC_MATCH)
|
33
33
|
|
34
34
|
# returns the mac address from the collection of all address types
|
35
35
|
def get_mac_address(addresses)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Author:: Lance Albertson (lance@osuosl.org>)
|
4
|
+
# Copyright:: Copyright (c) 2021 Oregon State University
|
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(:OsRelease) do
|
21
|
+
provides "os_release"
|
22
|
+
|
23
|
+
collect_data(:linux) do
|
24
|
+
os_release Mash.new unless os_release
|
25
|
+
|
26
|
+
# https://www.freedesktop.org/software/systemd/man/os-release.html
|
27
|
+
if file_exist?("/etc/os-release")
|
28
|
+
file_read("/etc/os-release").each_line do |line|
|
29
|
+
key, value = line.split("=")
|
30
|
+
if key == "ID_LIKE"
|
31
|
+
os_release[key.downcase] = value.chomp.gsub(/\A"|"\Z/, "").split(" ") if value
|
32
|
+
else
|
33
|
+
os_release[key.downcase] = value.chomp.gsub(/\A"|"\Z/, "") if value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
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
|
#
|
@@ -112,16 +112,17 @@ Ohai.plugin(:Platform) do
|
|
112
112
|
# ohai uses. If you're adding a new platform here and you want to change the name
|
113
113
|
# you'll want to add it here and then add a spec for the platform_id_remap method
|
114
114
|
{
|
115
|
-
"
|
115
|
+
"alinux" => "alibabalinux",
|
116
116
|
"amzn" => "amazon",
|
117
|
+
"archarm" => "arch",
|
118
|
+
"cumulus-linux" => "cumulus",
|
117
119
|
"ol" => "oracle",
|
118
|
-
"sles" => "suse",
|
119
|
-
"sles_sap" => "suse",
|
120
120
|
"opensuse-leap" => "opensuseleap",
|
121
|
+
"rhel" => "redhat",
|
122
|
+
"sles_sap" => "suse",
|
123
|
+
"sles" => "suse",
|
121
124
|
"xenenterprise" => "xenserver",
|
122
|
-
|
123
|
-
"archarm" => "arch",
|
124
|
-
}[id] || id
|
125
|
+
}[id.downcase] || id.downcase
|
125
126
|
end
|
126
127
|
|
127
128
|
#
|
@@ -133,20 +134,22 @@ Ohai.plugin(:Platform) do
|
|
133
134
|
#
|
134
135
|
def platform_family_from_platform(plat)
|
135
136
|
case plat
|
136
|
-
when /
|
137
|
+
when /ubuntu/, /debian/, /linuxmint/, /raspbian/, /cumulus/, /kali/, /pop/
|
137
138
|
# apt-get+dpkg almost certainly goes here
|
138
139
|
"debian"
|
139
|
-
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"
|
140
141
|
# NOTE: "rhel" should be reserved exclusively for recompiled rhel versions that are nearly perfectly compatible down to the platform_version.
|
141
142
|
# The operating systems that are "rhel" should all be as compatible as rhel7 = centos7 = oracle7 = scientific7 (98%-ish core RPM version compatibility
|
142
143
|
# and the version numbers MUST track the upstream). The appropriate EPEL version repo should work nearly perfectly. Some variation like the
|
143
|
-
# oracle kernel version differences and tuning and extra packages are clearly acceptable.
|
144
|
-
# 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,
|
145
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
|
146
149
|
"rhel"
|
147
150
|
when /amazon/
|
148
151
|
"amazon"
|
149
|
-
when /suse/, /sles/, /
|
152
|
+
when /suse/, /sles/, /opensuseleap/, /opensuse/, /sled/
|
150
153
|
"suse"
|
151
154
|
when /fedora/, /pidora/, /arista_eos/
|
152
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
|
@@ -156,8 +159,6 @@ Ohai.plugin(:Platform) do
|
|
156
159
|
"wrlinux"
|
157
160
|
when /gentoo/
|
158
161
|
"gentoo"
|
159
|
-
when /slackware/
|
160
|
-
"slackware"
|
161
162
|
when /arch/, /manjaro/, /antergos/
|
162
163
|
"arch"
|
163
164
|
when /exherbo/
|
@@ -168,6 +169,8 @@ Ohai.plugin(:Platform) do
|
|
168
169
|
"clearlinux"
|
169
170
|
when /mangeia/
|
170
171
|
"mandriva"
|
172
|
+
when /slackware/
|
173
|
+
"slackware"
|
171
174
|
end
|
172
175
|
end
|
173
176
|
|
@@ -270,9 +273,6 @@ Ohai.plugin(:Platform) do
|
|
270
273
|
elsif /XenServer/i.match?(lsb[:id])
|
271
274
|
platform "xenserver"
|
272
275
|
platform_version lsb[:release]
|
273
|
-
elsif /XCP/i.match?(lsb[:id])
|
274
|
-
platform "xcp"
|
275
|
-
platform_version lsb[:release]
|
276
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
|
277
277
|
platform lsb[:id].downcase
|
278
278
|
platform_version lsb[:release]
|
@@ -225,7 +225,11 @@ Ohai.plugin(:Virtualization) do
|
|
225
225
|
# If so, we may need to look further for a differentiator (OHAI-573)
|
226
226
|
virtualization[:systems][:lxc] = "host"
|
227
227
|
end
|
228
|
-
|
228
|
+
end
|
229
|
+
|
230
|
+
# regardless of what we found above, if we're a docker container inside
|
231
|
+
# of the above, lets report as a docker container
|
232
|
+
if file_exist?("/.dockerenv") || file_exist?("/.dockerinit")
|
229
233
|
logger.trace("Plugin Virtualization: .dockerenv or .dockerinit exist. Detecting as docker guest")
|
230
234
|
virtualization[:system] = "docker"
|
231
235
|
virtualization[:role] = "guest"
|
@@ -106,7 +106,7 @@ Ohai.plugin(:Packages) do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
def collect_programs_from_registry_key(key_path)
|
109
|
+
def collect_programs_from_registry_key(repo, key_path)
|
110
110
|
# from http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx
|
111
111
|
if ::RbConfig::CONFIG["target_cpu"] == "i386"
|
112
112
|
reg_type = Win32::Registry::KEY_READ | 0x100
|
@@ -115,7 +115,7 @@ Ohai.plugin(:Packages) do
|
|
115
115
|
else
|
116
116
|
reg_type = Win32::Registry::KEY_READ
|
117
117
|
end
|
118
|
-
|
118
|
+
repo.open(key_path, reg_type) do |reg|
|
119
119
|
reg.each_key do |key, _wtime|
|
120
120
|
pkg = reg.open(key)
|
121
121
|
name = pkg["DisplayName"] rescue nil
|
@@ -133,9 +133,11 @@ Ohai.plugin(:Packages) do
|
|
133
133
|
collect_data(:windows) do
|
134
134
|
require "win32/registry" unless defined?(Win32::Registry)
|
135
135
|
packages Mash.new
|
136
|
-
collect_programs_from_registry_key('Software\Microsoft\Windows\CurrentVersion\Uninstall')
|
136
|
+
collect_programs_from_registry_key(Win32::Registry::HKEY_LOCAL_MACHINE, 'Software\Microsoft\Windows\CurrentVersion\Uninstall')
|
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
|
+
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')
|
137
140
|
# on 64 bit systems, 32 bit programs are stored here
|
138
|
-
collect_programs_from_registry_key('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
|
139
141
|
end
|
140
142
|
|
141
143
|
collect_data(:aix) do
|
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.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-11-09 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
|
@@ -305,6 +305,7 @@ files:
|
|
305
305
|
- lib/ohai/plugins/linux/mdadm.rb
|
306
306
|
- lib/ohai/plugins/linux/memory.rb
|
307
307
|
- lib/ohai/plugins/linux/network.rb
|
308
|
+
- lib/ohai/plugins/linux/os_release.rb
|
308
309
|
- lib/ohai/plugins/linux/platform.rb
|
309
310
|
- lib/ohai/plugins/linux/selinux.rb
|
310
311
|
- lib/ohai/plugins/linux/sessions.rb
|