summaryrefslogtreecommitdiff
path: root/lib/chef/platform/query_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/platform/query_helpers.rb')
-rw-r--r--lib/chef/platform/query_helpers.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb
index a0bc162ef3..6e56eba120 100644
--- a/lib/chef/platform/query_helpers.rb
+++ b/lib/chef/platform/query_helpers.rb
@@ -26,7 +26,7 @@ class Chef
def windows_nano_server?
return false unless windows?
- require "win32/registry"
+ require "win32/registry" unless defined?(Win32::Registry)
# This method may be called before ohai runs (e.g., it may be used to
# determine settings in config.rb). Chef::Win32::Registry.new uses
@@ -48,7 +48,7 @@ class Chef
def supports_msi?
return false unless windows?
- require "win32/registry"
+ require "win32/registry" unless defined?(Win32::Registry)
key = "System\\CurrentControlSet\\Services\\msiserver"
access = ::Win32::Registry::KEY_QUERY_VALUE
@@ -90,7 +90,7 @@ class Chef
def supported_powershell_version?(node, version_string)
return false unless node[:languages] && node[:languages][:powershell]
- require "rubygems"
+ require "rubygems" unless defined?(Gem)
Gem::Version.new(node[:languages][:powershell][:version]) >=
Gem::Version.new(version_string)
end