summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md16
-rw-r--r--Gemfile2
-rw-r--r--VERSION2
-rw-r--r--lib/ohai/common/dmi.rb116
-rw-r--r--lib/ohai/mixin/network_helper.rb10
-rw-r--r--lib/ohai/plugins/fips.rb3
-rw-r--r--lib/ohai/plugins/linux/platform.rb3
-rw-r--r--lib/ohai/plugins/rpm.rb20
-rw-r--r--lib/ohai/util/ip_helper.rb4
-rw-r--r--lib/ohai/version.rb2
-rw-r--r--spec/unit/plugins/fips_spec.rb4
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb2
12 files changed, 103 insertions, 81 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e496a0b..6cb4be09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,21 @@
# Change Log
-<!-- latest_release -->
+<!-- latest_release 18.0.19 -->
+## [v18.0.19](https://github.com/chef/ohai/tree/v18.0.19) (2022-08-09)
+
+#### Merged Pull Requests
+- Add additional SUSE and openSUSE platforms - micro, hpc [#1753](https://github.com/chef/ohai/pull/1753) ([jamesongithub](https://github.com/jamesongithub))
<!-- latest_release -->
-<!-- release_rollup -->
+<!-- release_rollup since=18.0.14 -->
+### Changes not yet released to rubygems.org
+
+#### Merged Pull Requests
+- Add additional SUSE and openSUSE platforms - micro, hpc [#1753](https://github.com/chef/ohai/pull/1753) ([jamesongithub](https://github.com/jamesongithub)) <!-- 18.0.19 -->
+- Fix FIPS mode detection [#1754](https://github.com/chef/ohai/pull/1754) ([stanhu](https://github.com/stanhu)) <!-- 18.0.18 -->
+- Do not attempt to reinitialize constants [#1758](https://github.com/chef/ohai/pull/1758) ([balasankarc](https://github.com/balasankarc)) <!-- 18.0.17 -->
+- Update rubocop-performance requirement from 1.13.3 to 1.14.2 [#1751](https://github.com/chef/ohai/pull/1751) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 18.0.16 -->
+- chore: Included githubactions in the dependabot config [#1748](https://github.com/chef/ohai/pull/1748) ([naveensrinivasan](https://github.com/naveensrinivasan)) <!-- 18.0.15 -->
<!-- release_rollup -->
<!-- latest_stable_release -->
diff --git a/Gemfile b/Gemfile
index db66f7f7..d4aaa597 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,7 +16,7 @@ group :development do
gem "rspec-core", "~> 3.0"
gem "rspec-expectations", "~> 3.0"
gem "rspec-mocks", "~> 3.0"
- gem "rubocop-performance", "1.13.3"
+ gem "rubocop-performance", "1.14.2"
gem "rubocop-rspec"
end
diff --git a/VERSION b/VERSION
index c3da0e28..01d80d7c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-18.0.14 \ No newline at end of file
+18.0.19 \ No newline at end of file
diff --git a/lib/ohai/common/dmi.rb b/lib/ohai/common/dmi.rb
index faa440a7..7ca6ddf7 100644
--- a/lib/ohai/common/dmi.rb
+++ b/lib/ohai/common/dmi.rb
@@ -25,57 +25,59 @@ module Ohai
# all-lowercase, all non-alphanumeric converted to '_'
# 128-255 are 'oem_data_[id]'
# Everything else is 'unknown'
- ID_TO_DESCRIPTION = {
- 0 => "bios",
- 1 => "system",
- 2 => "base_board",
- 3 => "chassis",
- 4 => "processor",
- 5 => "memory_controller",
- 6 => "memory_module",
- 7 => "cache",
- 8 => "port_connector",
- 9 => "system_slots",
- 10 => "on_board_devices",
- 11 => "oem_strings",
- 12 => "system_configuration_options",
- 13 => "bios_language",
- 14 => "group_associations",
- 15 => "system_event_log",
- 16 => "physical_memory_array",
- 17 => "memory_device",
- 18 => "32_bit_memory_error",
- 19 => "memory_array_mapped_address",
- 20 => "memory_device_mapped_address",
- 21 => "built_in_pointing_device",
- 22 => "portable_battery",
- 23 => "system_reset",
- 24 => "hardware_security",
- 25 => "system_power_controls",
- 26 => "voltage_probe",
- 27 => "cooling_device",
- 28 => "temperature_probe",
- 29 => "electrical_current_probe",
- 30 => "out_of_band_remote_access",
- 31 => "boot_integrity_services",
- 32 => "system_boot",
- 33 => "64_bit_memory_error",
- 34 => "management_device",
- 35 => "management_device_component",
- 36 => "management_device_threshold_data",
- 37 => "memory_channel",
- 38 => "ipmi_device",
- 39 => "power_supply",
- 40 => "additional_information",
- 41 => "onboard_devices_extended_information",
- 42 => "management_controller_host_interfaces",
- 126 => "disabled_entries",
- 127 => "end_of_table_marker",
- }.freeze
+ unless defined?(ID_TO_DESCRIPTION)
+ ID_TO_DESCRIPTION = {
+ 0 => "bios",
+ 1 => "system",
+ 2 => "base_board",
+ 3 => "chassis",
+ 4 => "processor",
+ 5 => "memory_controller",
+ 6 => "memory_module",
+ 7 => "cache",
+ 8 => "port_connector",
+ 9 => "system_slots",
+ 10 => "on_board_devices",
+ 11 => "oem_strings",
+ 12 => "system_configuration_options",
+ 13 => "bios_language",
+ 14 => "group_associations",
+ 15 => "system_event_log",
+ 16 => "physical_memory_array",
+ 17 => "memory_device",
+ 18 => "32_bit_memory_error",
+ 19 => "memory_array_mapped_address",
+ 20 => "memory_device_mapped_address",
+ 21 => "built_in_pointing_device",
+ 22 => "portable_battery",
+ 23 => "system_reset",
+ 24 => "hardware_security",
+ 25 => "system_power_controls",
+ 26 => "voltage_probe",
+ 27 => "cooling_device",
+ 28 => "temperature_probe",
+ 29 => "electrical_current_probe",
+ 30 => "out_of_band_remote_access",
+ 31 => "boot_integrity_services",
+ 32 => "system_boot",
+ 33 => "64_bit_memory_error",
+ 34 => "management_device",
+ 35 => "management_device_component",
+ 36 => "management_device_threshold_data",
+ 37 => "memory_channel",
+ 38 => "ipmi_device",
+ 39 => "power_supply",
+ 40 => "additional_information",
+ 41 => "onboard_devices_extended_information",
+ 42 => "management_controller_host_interfaces",
+ 126 => "disabled_entries",
+ 127 => "end_of_table_marker",
+ }.freeze
+ end
# list of IDs to collect from config or default to a sane list that prunes
# away some of the less useful IDs
- ID_TO_CAPTURE = [ 0, 1, 2, 3, 4, 6, 11 ].freeze
+ ID_TO_CAPTURE = [ 0, 1, 2, 3, 4, 6, 11 ].freeze unless defined?(ID_TO_CAPTURE)
# the allowlisted DMI IDs. This is combination of the defaults + any additional
# IDs defined in the :additional_dmi_ids config
@@ -116,14 +118,16 @@ module Ohai
id
end
- SKIPPED_CONVENIENCE_KEYS = %w{
- application_identifier
- caption
- creation_class_name
- size
- system_creation_class_name
- record_id
- }.freeze
+ unless defined?(SKIPPED_CONVENIENCE_KEYS)
+ SKIPPED_CONVENIENCE_KEYS = %w{
+ application_identifier
+ caption
+ creation_class_name
+ size
+ system_creation_class_name
+ record_id
+ }.freeze
+ end
# create simplified convenience access keys for each record type
# for single occurrences of one type, copy to top level all fields and values
diff --git a/lib/ohai/mixin/network_helper.rb b/lib/ohai/mixin/network_helper.rb
index 8a75ad08..8547c11e 100644
--- a/lib/ohai/mixin/network_helper.rb
+++ b/lib/ohai/mixin/network_helper.rb
@@ -23,10 +23,12 @@ require "socket" unless defined?(Socket)
module Ohai
module Mixin
module NetworkHelper
- FAMILIES = {
- "inet" => "default",
- "inet6" => "default_inet6",
- }.freeze
+ unless defined?(FAMILIES)
+ FAMILIES = {
+ "inet" => "default",
+ "inet6" => "default_inet6",
+ }.freeze
+ end
def hex_to_dec_netmask(netmask)
# example 'ffff0000' -> '255.255.0.0'
diff --git a/lib/ohai/plugins/fips.rb b/lib/ohai/plugins/fips.rb
index 7cf40fdf..fdb5c133 100644
--- a/lib/ohai/plugins/fips.rb
+++ b/lib/ohai/plugins/fips.rb
@@ -30,6 +30,7 @@ Ohai.plugin(:Fips) do
fips Mash.new
require "openssl" unless defined?(OpenSSL)
- fips["kernel"] = { "enabled" => OpenSSL::OPENSSL_FIPS }
+
+ fips["kernel"] = { "enabled" => defined?(OpenSSL.fips_mode) && OpenSSL.fips_mode }
end
end
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index 3433bdf2..492c61ee 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -149,7 +149,8 @@ Ohai.plugin(:Platform) do
"rhel"
when /amazon/
"amazon"
- when /suse/, /sles/, /opensuseleap/, /opensuse/, /sled/
+ # suse matches opensuse, suse-* opensuse-*, etc. sle[sd\-_] intends to match sles, sled, sle-*, sle_*
+ when /suse/, /sle[sd\-_]/
"suse"
when /fedora/, /arista_eos/
# 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
diff --git a/lib/ohai/plugins/rpm.rb b/lib/ohai/plugins/rpm.rb
index c131ad50..c4247c54 100644
--- a/lib/ohai/plugins/rpm.rb
+++ b/lib/ohai/plugins/rpm.rb
@@ -22,16 +22,18 @@ Ohai.plugin(:Rpm) do
provides "rpm"
optional "true"
- MACROS_MARKER = /========================/.freeze
+ MACROS_MARKER = /========================/.freeze unless defined?(MACROS_MARKER)
- DO_NOT_SPLIT = %w{
- build_arch
- build_os
- install_arch
- install_os
- archcolor
- optflags
- }.freeze
+ unless defined?(DO_NOT_SPLIT)
+ DO_NOT_SPLIT = %w{
+ build_arch
+ build_os
+ install_arch
+ install_os
+ archcolor
+ optflags
+ }.freeze
+ end
collect_data(:aix, :darwin, :dragonflybsd, :freebsd, :linux, :netbsd, :openbsd, :solaris2) do
rpm_path = which("rpm")
diff --git a/lib/ohai/util/ip_helper.rb b/lib/ohai/util/ip_helper.rb
index 044afaec..64360ace 100644
--- a/lib/ohai/util/ip_helper.rb
+++ b/lib/ohai/util/ip_helper.rb
@@ -21,8 +21,8 @@ module Ohai
require "ipaddress" unless defined?(IPAddress)
# Corresponding to RFC 4192 + RFC 4193
- IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10")
- IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7")
+ IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10") unless defined?(IPV6_LINK_LOCAL_UNICAST_BLOCK)
+ IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7") unless defined?(IPV6_PRIVATE_ADDRESS_BLOCK)
def private_address?(addr)
ip = IPAddress(addr)
diff --git a/lib/ohai/version.rb b/lib/ohai/version.rb
index 438e46c4..0cdceff4 100644
--- a/lib/ohai/version.rb
+++ b/lib/ohai/version.rb
@@ -19,5 +19,5 @@
module Ohai
OHAI_ROOT = File.expand_path(__dir__)
- VERSION = "18.0.14"
+ VERSION = "18.0.19"
end
diff --git a/spec/unit/plugins/fips_spec.rb b/spec/unit/plugins/fips_spec.rb
index 0925eb16..7fdf10bb 100644
--- a/spec/unit/plugins/fips_spec.rb
+++ b/spec/unit/plugins/fips_spec.rb
@@ -33,14 +33,14 @@ describe Ohai::System, "plugin fips" do
context "when OpenSSL reports FIPS mode true" do
it "sets fips enabled true" do
- stub_const("OpenSSL::OPENSSL_FIPS", true)
+ allow(OpenSSL).to receive(:fips_mode).and_return(true)
expect(subject).to be(true)
end
end
context "when OpenSSL reports FIPS mode false" do
it "sets fips enabled false" do
- stub_const("OpenSSL::OPENSSL_FIPS", false)
+ allow(OpenSSL).to receive(:fips_mode).and_return(false)
expect(subject).to be(false)
end
end
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index 8d27e211..b3c0dbdc 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -181,7 +181,7 @@ describe Ohai::System, "Linux plugin platform" do
end
end
- %w{suse sles opensuse opensuseleap sled}.each do |p|
+ %w{suse sles opensuse opensuse-leap opensuseleap opensuse-tumbleweed opensuse-leap-micro opensuse-microos suse-microos sled sle-hpc sle_hpc sle_rt}.each do |p|
it "returns suse for #{p} platform_family" do
expect(plugin.platform_family_from_platform(p)).to eq("suse")
end