Skip to content

open(uri) is deprecated in Ruby 2.7 #83

@rledousa

Description

@rledousa

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions