Berkshelf downloader doesn't work to download file from URI in ruby 3.0 #2735
Labels
Status: Good First Issue
An issue ready for a new contributor.
Triage: Confirmed
Indicates and issue has been confirmed as described.
Description
We are having a internal supermarket with cookbook files stored on a web server. The location of cookbooks are provided in universe.json as:
When we run
berks install
, we get the error:Chef Workstation Version
Any version later than 21.6.467 that has ruby 3.0 bundled. It should start from 21.6.479 according to https://docs.chef.io/release_notes_workstation/.
Platform Version
CentOS 7, but it doesn't matter.
Root Cause
The bug is related to different behavior between
open-uri
in Ruby 2.x and 3.0. open-uri used to (before Ruby 3.0) overwrite Kernel#open to support downloading files from http URI. However, it is no more the case in Ruby 3.0. We should switch fromopen
method toURI.open
instead:lib/berkshelf/downloader.rb#155
You can also refer to the following link for details:
https://localcoder.org/no-such-file-or-directory-rb-sysopen-for-external-url-rails-6-11-ruby-3
The text was updated successfully, but these errors were encountered: