summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-04-07 15:45:49 -0700
committerGitHub <noreply@github.com>2022-04-07 15:45:49 -0700
commit3ccfc28cdf9d6320f0e576026c27dd51cfb28240 (patch)
tree6e95b1dd6e975cbf646737a6d43407b7717cfcfb /lib
parentdb6480f47f37954b9d3ac1fbb7837fbdb474646a (diff)
parentbc545a24c0b76ba9281ec733cc42e8f440b01c0f (diff)
downloadohai-3ccfc28cdf9d6320f0e576026c27dd51cfb28240.tar.gz
Merge pull request #1744 from chef/jfm/ohai_ruby3.1
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/mixin/os.rb2
-rw-r--r--lib/ohai/plugins/azure.rb6
-rw-r--r--lib/ohai/plugins/ec2.rb2
-rw-r--r--lib/ohai/plugins/gce.rb2
-rw-r--r--lib/ohai/plugins/openstack.rb2
-rw-r--r--lib/ohai/plugins/rackspace.rb2
6 files changed, 9 insertions, 7 deletions
diff --git a/lib/ohai/mixin/os.rb b/lib/ohai/mixin/os.rb
index 44d3686f..a6bfdf46 100644
--- a/lib/ohai/mixin/os.rb
+++ b/lib/ohai/mixin/os.rb
@@ -110,7 +110,7 @@ module Ohai
"dragonflybsd"
when /solaris2/
"solaris2"
- when /mswin|mingw32|windows/
+ when /mswin|mingw|windows/
# After long discussion in IRC the "powers that be" have come to a consensus
# that no Windows platform exists that was not based on the
# Windows_NT kernel, so we herby decree that "windows" will refer to all
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb
index c21b8ac7..008a9a21 100644
--- a/lib/ohai/plugins/azure.rb
+++ b/lib/ohai/plugins/azure.rb
@@ -73,9 +73,11 @@ Ohai.plugin(:Azure) do
end
def tcp_ip_dhcp_domain
- return unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ return unless RUBY_PLATFORM.match?(/mswin|mingw|windows/)
- require "win32/registry" unless defined?(Win32::Registry)
+ if ChefUtils.windows?
+ require "win32/registry" unless defined?(Win32::Registry)
+ end
begin
key = Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters")
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb
index 79c124fe..5799d838 100644
--- a/lib/ohai/plugins/ec2.rb
+++ b/lib/ohai/plugins/ec2.rb
@@ -81,7 +81,7 @@ Ohai.plugin(:EC2) do
# linux hosts
# @return [Boolean] do we have a Xen Identifying Number or not?
def has_ec2_identifying_number?
- if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
wmi = WmiLite::Wmi.new
if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
diff --git a/lib/ohai/plugins/gce.rb b/lib/ohai/plugins/gce.rb
index 90d63e96..fdfce390 100644
--- a/lib/ohai/plugins/gce.rb
+++ b/lib/ohai/plugins/gce.rb
@@ -49,7 +49,7 @@ Ohai.plugin(:GCE) do
# looks at the Manufacturer and Model WMI values to see if they starts with Google.
# @return [Boolean] Are the manufacturer and model Google?
def has_gce_system_info?
- if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
wmi = WmiLite::Wmi.new
computer_system = wmi.first_of("Win32_ComputerSystem")
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb
index 1c1f7abc..b851ef02 100644
--- a/lib/ohai/plugins/openstack.rb
+++ b/lib/ohai/plugins/openstack.rb
@@ -49,7 +49,7 @@ Ohai.plugin(:Openstack) do
# https://help.dreamhost.com/hc/en-us/articles/228377408-How-to-find-the-default-user-of-an-image
def openstack_provider
# dream host doesn't support windows so bail early if we're on windows
- return "openstack" if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ return "openstack" if RUBY_PLATFORM.match?(/mswin|mingw|windows/)
if Etc::Passwd.entries.map(&:name).include?("dhc-user")
"dreamhost"
diff --git a/lib/ohai/plugins/rackspace.rb b/lib/ohai/plugins/rackspace.rb
index 469290b6..b7a1a795 100644
--- a/lib/ohai/plugins/rackspace.rb
+++ b/lib/ohai/plugins/rackspace.rb
@@ -48,7 +48,7 @@ Ohai.plugin(:Rackspace) do
# true:: If the rackspace cloud can be identified
# false:: Otherwise
def has_rackspace_manufacturer?
- return false unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
+ return false unless RUBY_PLATFORM.match?(/mswin|mingw|windows/)
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
wmi = WmiLite::Wmi.new