kindredgroup / puppet-forge-server

Private Puppet forge server supports local files and both v1 and v3 API proxies
69 stars 44 forks source link

open(uri) is deprecated in Ruby 2.7 #83

Open rledousa opened 3 years ago

rledousa commented 3 years ago

Starting puppet-forge-server with Ruby 2.7 fails with

[2021-01-27 23:57:17] DEBUG Fetching data for url: https://forgeapi.puppetlabs.com/v3/modules/puppetlabs-stdlib from remote server /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/puppet-forge-server-1.10.1/lib/puppet_forge_server/http/http_client.rb:89: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open

Offending line is http_client.rb:89

I'm not a Ruby developer so I don't know how best to submit a patch which covers the various Ruby versions out there, but changing open(url, @uri_options) -> OpenURI.open_uri(url, @uri_options) fixes the problem

/opt/puppetlabs/puppet/bin/ruby --version

ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]