diff options
Diffstat (limited to 'lib/chef/platform/query_helpers.rb')
-rw-r--r-- | lib/chef/platform/query_helpers.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb index 028a220a5d..f9f7af0343 100644 --- a/lib/chef/platform/query_helpers.rb +++ b/lib/chef/platform/query_helpers.rb @@ -30,11 +30,19 @@ class Chef def windows_server_2003? return false unless windows? - require 'ruby-wmi' + # CHEF-4888: Work around ruby #2618, expected to be fixed in Ruby 2.1.0 + # https://github.com/ruby/ruby/commit/588504b20f5cc880ad51827b93e571e32446e5db + # https://github.com/ruby/ruby/commit/27ed294c7134c0de582007af3c915a635a6506cd + WIN32OLE.ole_initialize + host = WMI::Win32_OperatingSystem.find(:first) - (host.version && host.version.start_with?("5.2")) + is_server_2003 = (host.version && host.version.start_with?("5.2")) + + WIN32OLE.ole_uninitialize + + is_server_2003 end end |