ohai 14.8.12 → 14.14.0
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/lib/ohai/plugins/linux/platform.rb +7 -4
- data/lib/ohai/plugins/packages.rb +28 -1
- data/lib/ohai/plugins/windows/filesystem.rb +2 -2
- data/lib/ohai/version.rb +1 -1
- data/spec/data/plugins/rpmquery.output +2 -0
- data/spec/unit/plugins/linux/platform_spec.rb +63 -26
- data/spec/unit/plugins/packages_spec.rb +20 -0
- data/spec/unit/plugins/windows/fips_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442b21d4ae9ca4922c53910eed1b2257dbd582082c2030b9f13cacd397ff6d93
|
4
|
+
data.tar.gz: 986f3a7dcdaace61f03781f22b574cada206b5b412d5bfcc22c70feaa76139e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f214b2ed18dac602b3584e357be8df031c68877453c03d6d7622b278b8b7c10b054c756e905075ebbee1bfc72161e29867f5259ce37945b5bb1a673e4c7274d5
|
7
|
+
data.tar.gz: 24cd4341f70257b239d38187c490ce60a0ced05e7a574c0f4cec1f697d535d5cea55a48f21f6901b966bffe3ba3a495a192f853c9c96c462f6c79ac107bdc7f3
|
@@ -249,7 +249,7 @@ Ohai.plugin(:Platform) do
|
|
249
249
|
# the gentoo release version is the base version used to bootstrap
|
250
250
|
# a node and doesn't have a lot of meaning in a rolling release distro
|
251
251
|
# kernel release will be used - ex. 3.18.7-gentoo
|
252
|
-
platform_version
|
252
|
+
platform_version shell_out("/bin/uname -r").stdout.strip
|
253
253
|
elsif File.exist?("/etc/slackware-version")
|
254
254
|
platform "slackware"
|
255
255
|
platform_version File.read("/etc/slackware-version").scan(/(\d+|\.+)/).join
|
@@ -257,16 +257,17 @@ Ohai.plugin(:Platform) do
|
|
257
257
|
platform "arch"
|
258
258
|
# no way to determine platform_version in a rolling release distribution
|
259
259
|
# kernel release will be used - ex. 2.6.32-ARCH
|
260
|
-
platform_version
|
260
|
+
platform_version shell_out("/bin/uname -r").stdout.strip
|
261
261
|
elsif File.exist?("/etc/exherbo-release")
|
262
262
|
platform "exherbo"
|
263
263
|
# no way to determine platform_version in a rolling release distribution
|
264
264
|
# kernel release will be used - ex. 3.13
|
265
|
-
platform_version
|
265
|
+
platform_version shell_out("/bin/uname -r").stdout.strip
|
266
266
|
elsif File.exist?("/etc/alpine-release")
|
267
267
|
platform "alpine"
|
268
268
|
platform_version File.read("/etc/alpine-release").strip
|
269
|
-
|
269
|
+
# If /etc/os-release file exists, we take that as source of truth
|
270
|
+
elsif File.exist?("/usr/lib/os-release") && !File.exist?("/etc/os-release")
|
270
271
|
contents = File.read("/usr/lib/os-release")
|
271
272
|
if /Clear Linux/ =~ contents
|
272
273
|
platform "clearlinux"
|
@@ -300,6 +301,8 @@ Ohai.plugin(:Platform) do
|
|
300
301
|
platform "suse" # SLES is wrong. We call it SUSE
|
301
302
|
when "opensuse-leap"
|
302
303
|
platform "opensuseleap"
|
304
|
+
when "clear-linux-os"
|
305
|
+
platform "clearlinux"
|
303
306
|
else
|
304
307
|
platform os_release_info["ID"]
|
305
308
|
end
|
@@ -50,7 +50,34 @@ Ohai.plugin(:Packages) do
|
|
50
50
|
|
51
51
|
pkgs.each do |pkg|
|
52
52
|
name, epoch, version, release, installdate, arch = pkg.split
|
53
|
-
packages[name]
|
53
|
+
if packages[name]
|
54
|
+
# We have more than one package with this exact name!
|
55
|
+
# Create an "versions" array for tracking all versions of packages with this name.
|
56
|
+
# The top-level package information will be the first one returned by rpm -qa,
|
57
|
+
# all versions go in this list, with the same information they'd normally have.
|
58
|
+
if packages[name]["versions"].nil?
|
59
|
+
# add the data of the first package to the list, so that all versions are in the list.
|
60
|
+
packages[name]["versions"] = []
|
61
|
+
packages[name]["versions"] << Mash.new({ "epoch" => packages[name]["epoch"],
|
62
|
+
"version" => packages[name]["version"],
|
63
|
+
"release" => packages[name]["release"],
|
64
|
+
"installdate" => packages[name]["installdate"],
|
65
|
+
"arch" => packages[name]["arch"] })
|
66
|
+
end
|
67
|
+
packages[name]["versions"] << Mash.new({ "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }) # Add this package version to the list
|
68
|
+
# When this was originally written, it didn't account for multiple versions of the same package
|
69
|
+
# so it just kept clobbering the package data if it encountered multiple versions
|
70
|
+
# of the same package. As a result, the last duplicate returned by rpm -qa was what was present;
|
71
|
+
# here we clobber that data for compatibility. Note that we can't overwrite the entire hash
|
72
|
+
# without losing the versions array.
|
73
|
+
packages[name]["epoch"] = epoch
|
74
|
+
packages[name]["version"] = version
|
75
|
+
packages[name]["release"] = release
|
76
|
+
packages[name]["installdate"] = installdate
|
77
|
+
packages[name]["arch"] = arch
|
78
|
+
else
|
79
|
+
packages[name] = { "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }
|
80
|
+
end
|
54
81
|
end
|
55
82
|
|
56
83
|
when "arch"
|
@@ -23,8 +23,8 @@ Ohai.plugin(:Filesystem) do
|
|
23
23
|
#
|
24
24
|
# @see https://docs.microsoft.com/en-us/windows/desktop/SecProv/getconversionstatus-win32-encryptablevolume#parameters
|
25
25
|
#
|
26
|
-
CONVERSION_STATUS
|
27
|
-
|
26
|
+
CONVERSION_STATUS ||= %w{FullyDecrypted FullyEncrypted EncryptionInProgress
|
27
|
+
DecryptionInProgress EncryptionPaused DecryptionPaused}.freeze
|
28
28
|
|
29
29
|
# Returns a Mash loaded with logical details
|
30
30
|
#
|
data/lib/ohai/version.rb
CHANGED
@@ -3,3 +3,5 @@ tzdata 0 2016d 1.el7 1463486618 noarch
|
|
3
3
|
nss-softokn-freebl 0 3.16.2.3 14.2.el7_2 1463486619 x86_64
|
4
4
|
glibc 0 2.17 106.el7_2.6 1463486666 x86_64
|
5
5
|
libstdc++ 0 4.8.5 4.el7 1463486669 x86_64
|
6
|
+
kernel 0 3.10.0 862.2.3.el7 1526310781 x86_64
|
7
|
+
kernel 0 3.10.0 862.el7 1521745632 x86_64
|
@@ -250,7 +250,7 @@ OS_RELEASE
|
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should set platform_version to kernel release" do
|
253
|
-
expect(@plugin).to receive(
|
253
|
+
expect(@plugin).to receive(:shell_out).with("/bin/uname -r").and_return(mock_shell_out(0, "3.18.2-2-ARCH\n", ""))
|
254
254
|
@plugin.run
|
255
255
|
expect(@plugin[:platform_version]).to eq("3.18.2-2-ARCH")
|
256
256
|
end
|
@@ -271,7 +271,7 @@ OS_RELEASE
|
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should set platform_version to kernel release" do
|
274
|
-
expect(@plugin).to receive(
|
274
|
+
expect(@plugin).to receive(:shell_out).with("/bin/uname -r").and_return(mock_shell_out(0, "3.18.7-gentoo\n", ""))
|
275
275
|
@plugin.run
|
276
276
|
expect(@plugin[:platform_version]).to eq("3.18.7-gentoo")
|
277
277
|
end
|
@@ -345,7 +345,7 @@ OS_RELEASE
|
|
345
345
|
end
|
346
346
|
|
347
347
|
it "should set platform_version to kernel release" do
|
348
|
-
expect(@plugin).to receive(
|
348
|
+
expect(@plugin).to receive(:shell_out).with("/bin/uname -r").and_return(mock_shell_out(0, "3.18.2-2-ARCH", ""))
|
349
349
|
@plugin.run
|
350
350
|
expect(@plugin[:platform_version]).to eq("3.18.2-2-ARCH")
|
351
351
|
end
|
@@ -705,6 +705,7 @@ CISCO_RELEASE
|
|
705
705
|
describe "on suse" do
|
706
706
|
context "on openSUSE 15+" do
|
707
707
|
|
708
|
+
let(:have_usr_lib_os_release) { true }
|
708
709
|
let(:have_suse_release) { false }
|
709
710
|
let(:have_os_release) { true }
|
710
711
|
|
@@ -992,33 +993,69 @@ OS_RELEASE
|
|
992
993
|
end
|
993
994
|
|
994
995
|
describe "on clearlinux" do
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
996
|
+
context "without /etc/os-release file" do
|
997
|
+
let(:have_os_release) { false }
|
998
|
+
let(:have_usr_lib_os_release) { true }
|
999
|
+
let(:usr_lib_os_release_content) do
|
1000
|
+
<<~CLEARLINUX_RELEASE
|
1001
|
+
NAME="Clear Linux Software for Intel Architecture"
|
1002
|
+
VERSION=1
|
1003
|
+
ID=clear-linux-os
|
1004
|
+
VERSION_ID=16140
|
1005
|
+
PRETTY_NAME="Clear Linux OS for Intel Architecture"
|
1006
|
+
ANSI_COLOR="1;35"
|
1007
|
+
HOME_URL="https://clearlinux.org"
|
1008
|
+
SUPPORT_URL="https://clearlinux.org"
|
1009
|
+
BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
|
1010
|
+
PRIVACY_POLICY_URL="http://www.intel.com/privacy"
|
1011
|
+
CLEARLINUX_RELEASE
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
before do
|
1015
|
+
expect(File).to receive(:read).with("/usr/lib/os-release").and_return(usr_lib_os_release_content)
|
1016
|
+
end
|
1010
1017
|
|
1011
|
-
|
1012
|
-
|
1018
|
+
it "should set platform to clearlinux and platform_family to clearlinux" do
|
1019
|
+
@plugin.lsb = nil
|
1020
|
+
@plugin.run
|
1021
|
+
|
1022
|
+
expect(@plugin[:platform]).to eq("clearlinux")
|
1023
|
+
expect(@plugin[:platform_family]).to eq("clearlinux")
|
1024
|
+
expect(@plugin[:platform_version]).to eq("16140")
|
1025
|
+
end
|
1013
1026
|
end
|
1014
1027
|
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1028
|
+
context "with /etc/os-release file" do
|
1029
|
+
let(:have_os_release) { true }
|
1030
|
+
let(:have_usr_lib_os_release) { true }
|
1031
|
+
let(:os_release_content) do
|
1032
|
+
<<~CLEARLINUX_RELEASE
|
1033
|
+
NAME="Clear Linux Software for Intel Architecture"
|
1034
|
+
VERSION=1
|
1035
|
+
ID=clear-linux-os
|
1036
|
+
VERSION_ID=16140
|
1037
|
+
PRETTY_NAME="Clear Linux OS for Intel Architecture"
|
1038
|
+
ANSI_COLOR="1;35"
|
1039
|
+
HOME_URL="https://clearlinux.org"
|
1040
|
+
SUPPORT_URL="https://clearlinux.org"
|
1041
|
+
BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
|
1042
|
+
PRIVACY_POLICY_URL="http://www.intel.com/privacy"
|
1043
|
+
CLEARLINUX_RELEASE
|
1044
|
+
end
|
1018
1045
|
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1046
|
+
before do
|
1047
|
+
expect(File).to receive(:read).with("/etc/os-release").and_return(os_release_content)
|
1048
|
+
expect(File).not_to receive(:read).with("/usr/lib/os-release")
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
it "should set platform to clearlinux and platform_family to clearlinux" do
|
1052
|
+
@plugin.lsb = nil
|
1053
|
+
@plugin.run
|
1054
|
+
|
1055
|
+
expect(@plugin[:platform]).to eq("clearlinux")
|
1056
|
+
expect(@plugin[:platform_family]).to eq("clearlinux")
|
1057
|
+
expect(@plugin[:platform_version]).to eq("16140")
|
1058
|
+
end
|
1022
1059
|
end
|
1023
1060
|
end
|
1024
1061
|
end
|
@@ -100,6 +100,26 @@ describe Ohai::System, "plugin packages" do
|
|
100
100
|
expect(plugin[:packages]["tzdata"][:installdate]).to eq("1463486618")
|
101
101
|
expect(plugin[:packages]["tzdata"][:arch]).to eq("noarch")
|
102
102
|
end
|
103
|
+
|
104
|
+
it "handles multiple packages with the same name" do
|
105
|
+
expect(plugin[:packages]["kernel"][:version]).to eq("3.10.0")
|
106
|
+
expect(plugin[:packages]["kernel"][:release]).to eq("862.el7")
|
107
|
+
expect(plugin[:packages]["kernel"][:epoch]).to eq("0")
|
108
|
+
expect(plugin[:packages]["kernel"][:installdate]).to eq("1521745632")
|
109
|
+
expect(plugin[:packages]["kernel"][:arch]).to eq("x86_64")
|
110
|
+
# and now the version list:
|
111
|
+
expect(plugin[:packages]["kernel"]["versions"].first[:version]).to eq("3.10.0")
|
112
|
+
expect(plugin[:packages]["kernel"]["versions"].first[:release]).to eq("862.2.3.el7")
|
113
|
+
expect(plugin[:packages]["kernel"]["versions"].first[:epoch]).to eq("0")
|
114
|
+
expect(plugin[:packages]["kernel"]["versions"].first[:installdate]).to eq("1526310781")
|
115
|
+
expect(plugin[:packages]["kernel"]["versions"].first[:arch]).to eq("x86_64")
|
116
|
+
expect(plugin[:packages]["kernel"]["versions"].last[:version]).to eq("3.10.0")
|
117
|
+
expect(plugin[:packages]["kernel"]["versions"].last[:release]).to eq("862.el7")
|
118
|
+
expect(plugin[:packages]["kernel"]["versions"].last[:epoch]).to eq("0")
|
119
|
+
expect(plugin[:packages]["kernel"]["versions"].last[:installdate]).to eq("1521745632")
|
120
|
+
expect(plugin[:packages]["kernel"]["versions"].last[:arch]).to eq("x86_64")
|
121
|
+
|
122
|
+
end
|
103
123
|
end
|
104
124
|
|
105
125
|
context "on arch" do
|
@@ -98,6 +98,7 @@ describe Ohai::System, "plugin fips", :windows_only do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
context "with Ruby 2.5 or newer", if: defined?(OpenSSL.fips_mode) do
|
101
|
+
let(:arch) { Win32::Registry::KEY_READ }
|
101
102
|
let(:openssl_test_mode) { false }
|
102
103
|
|
103
104
|
context "with OpenSSL.fips_mode == false" do
|
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: 14.
|
4
|
+
version: 14.14.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: 2019-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|