summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/application/base.rb2
-rw-r--r--lib/chef/client.rb4
-rw-r--r--lib/chef/node/attribute.rb6
-rw-r--r--lib/chef/provider/package/rubygems.rb3
4 files changed, 9 insertions, 6 deletions
diff --git a/lib/chef/application/base.rb b/lib/chef/application/base.rb
index ad8e8b69c2..450fd7673b 100644
--- a/lib/chef/application/base.rb
+++ b/lib/chef/application/base.rb
@@ -368,7 +368,7 @@ class Chef::Application::Base < Chef::Application
FileUtils.cp(url, path)
elsif URI::DEFAULT_PARSER.make_regexp.match?(url)
File.open(path, "wb") do |f|
- open(url) do |r|
+ URI.open(url) do |r|
f.write(r.read)
end
end
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 094b59fc35..54d2a95ba3 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -858,8 +858,8 @@ class Chef
def profiling_prereqs!
require "ruby-prof"
- rescue LoadError
- raise "You must have the ruby-prof gem installed in order to use --profile-ruby"
+ rescue LoadError => e
+ raise "You must have the ruby-prof gem installed in order to use --profile-ruby: #{e.message}"
end
def start_profiling
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb
index 3383b3c7e5..6a8e72004b 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -158,8 +158,10 @@ class Chef
}.freeze
ENUM_METHODS.each do |delegated_method|
- define_method(delegated_method) do |*args, &block|
- merged_attributes.send(delegated_method, *args, &block)
+ if Hash.public_method_defined?(delegated_method)
+ define_method(delegated_method) do |*args, &block|
+ merged_attributes.send(delegated_method, *args, &block)
+ end
end
end
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index a0b569b8e3..e427cc0d24 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -189,7 +189,8 @@ class Chef
begin
rs = dependency_installer.resolve_dependencies gem_dependency.name, gem_dependency.requirement
rs.specs.find { |s| s.name == gem_dependency.name }
- rescue Gem::UnsatisfiableDependencyError
+ # ruby-3.0.0 versions of rubygems-3.x throws NoMethodError when the dep is not found
+ rescue Gem::UnsatisfiableDependencyError, NoMethodError
nil
end
end