summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/local_mode.rb9
-rw-r--r--lib/chef/monkey_patches/win32/registry.rb28
2 files changed, 4 insertions, 33 deletions
diff --git a/lib/chef/local_mode.rb b/lib/chef/local_mode.rb
index 5630a54335..457144c612 100644
--- a/lib/chef/local_mode.rb
+++ b/lib/chef/local_mode.rb
@@ -1,6 +1,6 @@
#
# Author:: John Keiser (<jkeiser@chef.io>)
-# Copyright:: Copyright 2013-2016, Chef Software Inc.
+# Copyright:: Copyright 2013-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +14,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
require "chef/config"
-if Chef::Platform.windows?
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1")
- require "chef/monkey_patches/webrick-utils"
- end
-end
+require "chef/monkey_patches/webrick-utils" if Chef::Platform.windows?
class Chef
module LocalMode
diff --git a/lib/chef/monkey_patches/win32/registry.rb b/lib/chef/monkey_patches/win32/registry.rb
index a08d67becf..26ba31d60f 100644
--- a/lib/chef/monkey_patches/win32/registry.rb
+++ b/lib/chef/monkey_patches/win32/registry.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2015-2016, Chef Software, Inc.
+# Copyright:: Copyright 2015-2019, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -56,31 +56,5 @@ module Win32
end
end
-
- if RUBY_VERSION =~ /^2\.1/
- # ::Win32::Registry#write does not correctly handle data in Ruby 2.1
- # This bug is _reportedly_ resolved in Ruby 2.1.7 and 2.2.3
- # but fails in appveyor on 2.1.8 unless we keep applying this monkeypatch
- # https://bugs.ruby-lang.org/issues/11439
- def write(name, type, data)
- case type
- when REG_SZ, REG_EXPAND_SZ
- data = data.to_s.encode(WCHAR) + WCHAR_NUL
- when REG_MULTI_SZ
- data = data.to_a.map { |s| s.encode(WCHAR) }.join(WCHAR_NUL) << WCHAR_NUL << WCHAR_NUL
- when REG_BINARY
- data = data.to_s
- when REG_DWORD
- data = API.packdw(data.to_i)
- when REG_DWORD_BIG_ENDIAN
- data = [data.to_i].pack("N")
- when REG_QWORD
- data = API.packqw(data.to_i)
- else
- raise TypeError, "Unsupported type #{type}"
- end
- API.SetValue(@hkey, name, type, data, data.bytesize)
- end
- end
end
end