ohai 14.8.12 → 14.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61eb9faf51ec7576615a1e2008efcbb3e38e2cf111f014485a47ecb92fa98129
4
- data.tar.gz: 35427a353fea6bef1a6153a75f587544937acc190a16bc8939cff499f98ae0d7
3
+ metadata.gz: 442b21d4ae9ca4922c53910eed1b2257dbd582082c2030b9f13cacd397ff6d93
4
+ data.tar.gz: 986f3a7dcdaace61f03781f22b574cada206b5b412d5bfcc22c70feaa76139e6
5
5
  SHA512:
6
- metadata.gz: 39242900794bc6d92287b27e2f79b2dd0e66a2ef2efe09c49090b72b03e5911a4a6769bb8e1acb824a5d17bc2c0b88295e53426221768edc563b9d2887ed14e3
7
- data.tar.gz: 8ec9786918e6817b1c548ad5c2a803dd0c6f4f226c5904e00184e1245bfcbbe27ecf33cfa4839fbbeb34177c2cc8823fe0325446045cb3ad055adaf85ab780d9
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 `uname -r`.strip
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 `uname -r`.strip
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 `uname -r`.strip
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
- elsif File.exist?("/usr/lib/os-release")
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] = { "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }
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 = %w{FullyDecrypted FullyEncrypted EncryptionInProgress
27
- DecryptionInProgress EncryptionPaused DecryptionPaused}.freeze
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
  #
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "14.8.12".freeze
21
+ VERSION = "14.14.0".freeze
22
22
  end
@@ -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(:`).with("uname -r").and_return("3.18.2-2-ARCH")
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(:`).with("uname -r").and_return("3.18.7-gentoo")
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(:`).with("uname -r").and_return("3.18.2-2-ARCH")
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
- let(:have_usr_lib_os_release) { true }
996
- let(:usr_lib_os_release_content) do
997
- <<~CLEARLINUX_RELEASE
998
- NAME="Clear Linux Software for Intel Architecture"
999
- VERSION=1
1000
- ID=clear-linux-os
1001
- VERSION_ID=16140
1002
- PRETTY_NAME="Clear Linux OS for Intel Architecture"
1003
- ANSI_COLOR="1;35"
1004
- HOME_URL="https://clearlinux.org"
1005
- SUPPORT_URL="https://clearlinux.org"
1006
- BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
1007
- PRIVACY_POLICY_URL="http://www.intel.com/privacy"
1008
- CLEARLINUX_RELEASE
1009
- end
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
- before do
1012
- expect(File).to receive(:read).with("/usr/lib/os-release").and_return(usr_lib_os_release_content)
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
- it "should set platform to clearlinux and platform_family to clearlinux" do
1016
- @plugin.lsb = nil
1017
- @plugin.run
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
- expect(@plugin[:platform]).to eq("clearlinux")
1020
- expect(@plugin[:platform_family]).to eq("clearlinux")
1021
- expect(@plugin[:platform_version]).to eq("16140")
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.8.12
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-05-10 00:00:00.000000000 Z
11
+ date: 2019-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu