87 lines
2.7 KiB
Diff
87 lines
2.7 KiB
Diff
From 4f56ee5f83943a72e4e7bec5dc118bc9b969210b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
|
|
Date: Sat, 9 May 2026 11:28:45 +0200
|
|
Subject: [PATCH] Ruby 4 fixes from OpenVox
|
|
|
|
---
|
|
lib/puppet/util/execution.rb | 4 ++--
|
|
lib/puppet/util/monkey_patches.rb | 21 +--------------------
|
|
lib/puppet/util/tag_set.rb | 3 ++-
|
|
3 files changed, 5 insertions(+), 23 deletions(-)
|
|
|
|
diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb
|
|
index c8673d2..171f49a 100644
|
|
--- a/lib/puppet/util/execution.rb
|
|
+++ b/lib/puppet/util/execution.rb
|
|
@@ -78,8 +78,8 @@ module Puppet::Util::Execution
|
|
# a predictable output
|
|
english_env = ENV.to_hash.merge({ 'LANG' => 'C', 'LC_ALL' => 'C' })
|
|
output = Puppet::Util.withenv(english_env) do
|
|
- # We are intentionally using 'pipe' with open to launch a process
|
|
- open("| #{command_str} 2>&1") do |pipe| # rubocop:disable Security/Open
|
|
+ # Use IO.popen instead of open for Ruby 4 compatibility
|
|
+ IO.popen("#{command_str} 2>&1", "r") do |pipe|
|
|
yield pipe
|
|
end
|
|
end
|
|
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
|
|
index 0f72188..51d7260 100644
|
|
--- a/lib/puppet/util/monkey_patches.rb
|
|
+++ b/lib/puppet/util/monkey_patches.rb
|
|
@@ -22,15 +22,6 @@ module RDoc
|
|
end
|
|
end
|
|
|
|
-class Object
|
|
- # ActiveSupport 2.3.x mixes in a dangerous method
|
|
- # that can cause rspec to fork bomb
|
|
- # and other strange things like that.
|
|
- def daemonize
|
|
- raise NotImplementedError, "Kernel.daemonize is too dangerous, please don't try to use it."
|
|
- end
|
|
-end
|
|
-
|
|
unless Dir.singleton_methods.include?(:exists?)
|
|
class Dir
|
|
def self.exists?(file_name)
|
|
@@ -52,22 +43,12 @@ end
|
|
require_relative '../../puppet/ssl/openssl_loader'
|
|
unless Puppet::Util::Platform.jruby_fips?
|
|
class OpenSSL::SSL::SSLContext
|
|
- if DEFAULT_PARAMS[:options]
|
|
- DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv3
|
|
- else
|
|
- DEFAULT_PARAMS[:options] = OpenSSL::SSL::OP_NO_SSLv3
|
|
- end
|
|
-
|
|
alias __original_initialize initialize
|
|
private :__original_initialize
|
|
|
|
def initialize(*args)
|
|
__original_initialize(*args)
|
|
- params = {
|
|
- :options => DEFAULT_PARAMS[:options],
|
|
- :ciphers => DEFAULT_PARAMS[:ciphers],
|
|
- }
|
|
- set_params(params)
|
|
+ set_params
|
|
end
|
|
end
|
|
end
|
|
diff --git a/lib/puppet/util/tag_set.rb b/lib/puppet/util/tag_set.rb
|
|
index 6bc09db..2ec1d19 100644
|
|
--- a/lib/puppet/util/tag_set.rb
|
|
+++ b/lib/puppet/util/tag_set.rb
|
|
@@ -11,7 +11,8 @@ class Puppet::Util::TagSet < Set
|
|
end
|
|
|
|
def to_yaml
|
|
- @hash.keys.to_yaml
|
|
+ # Ruby 4 changed Set's internal structure, use to_a instead of @hash.keys
|
|
+ to_a.to_yaml
|
|
end
|
|
|
|
def self.from_data_hash(data)
|
|
--
|
|
2.54.0
|
|
|