summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2022-03-21 14:19:14 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2022-03-21 14:19:14 -0700
commitbf996fa813d4bb781c4171a29caa3b2c721994f5 (patch)
treeb2e0a3bc8b8e5b00c941b70a7b2074c808346073
parent64871f29aa638b9c52e33aaccb047e3bea5e8c80 (diff)
downloadchef-bf996fa813d4bb781c4171a29caa3b2c721994f5.tar.gz
Ruby 3.1 fixes
caller_location.first.absolute_path returns nil sometimes on ruby 3.1 switch to .path which is going to always be an absolute path anyway, but which ruby 3.1 doesn't return nil for. i have no idea why. smells like a ruby language bug. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider.rb2
-rw-r--r--lib/chef/resource.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb
index 5fda36ac63..cf5c5c983e 100644
--- a/lib/chef/provider.rb
+++ b/lib/chef/provider.rb
@@ -113,7 +113,7 @@ class Chef
dirname = ::File.dirname(partial)
basename = ::File.basename(partial, ".rb")
basename = basename[1..] if basename.start_with?("_")
- class_eval IO.read(::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(caller_locations.first.absolute_path)))
+ class_eval IO.read(::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(caller_locations.first.path)))
end
# delegate to the resource
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index f9ab292b83..7f65f28fdd 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -1501,7 +1501,7 @@ class Chef
dirname = ::File.dirname(partial)
basename = ::File.basename(partial, ".rb")
basename = basename[1..] if basename.start_with?("_")
- class_eval IO.read(::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(caller_locations.first.absolute_path)))
+ class_eval IO.read(::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(caller_locations.first.path)))
end
# The cookbook in which this Resource was defined (if any).