From b9562bc9eb8ba4a2b2f6b1bb3b344eb42c6aa61e Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Mon, 3 Nov 2025 12:19:52 -0800 Subject: [PATCH] Bump to Faraday 2 Faraday 2 was released in early 2022. As part of this major release, authentication helper methods (such as basic_auth) were removed from the Connection object and into middleware. This commit updates vmfloaty's dependency on Faraday to ~> 2 and updates the Http class to use the new authentication middleware. This upgrade is helpful because, in a CI context, vmfloaty is often installed alongside other gems that use Faraday >= 2, and vmfloaty's current dependency on Faraday ~> 1.5, >= 1.5.1 can cause unexpected dependency resolution. You can read more about this unexpected dependency behavior in this GitHub issue: https://github.com/puppetlabs/orchestrator_client-ruby/issues/41 --- Gemfile.lock | 112 ++++++++++++++++++++----------------------- lib/vmfloaty/http.rb | 2 +- vmfloaty.gemspec | 2 +- 3 files changed, 53 insertions(+), 63 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7d27ddd..2027abd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,110 +3,100 @@ PATH specs: vmfloaty (1.8.1) commander (>= 4.4.3, < 4.7.0) - faraday (~> 1.5, >= 1.5.1) + faraday (~> 2) GEM remote: https://rubygems.org/ specs: - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) - bigdecimal (3.1.8) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + bigdecimal (3.3.1) coderay (1.1.3) commander (4.6.0) highline (~> 2.0.0) - crack (1.0.0) + crack (1.0.1) bigdecimal rexml - diff-lcs (1.5.1) - docile (1.4.0) - faraday (1.10.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) - ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - hashdiff (1.1.0) + diff-lcs (1.6.2) + docile (1.4.1) + faraday (2.14.0) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.1) + net-http (>= 0.5.0) + hashdiff (1.2.1) highline (2.0.3) - json (2.7.2) - language_server-protocol (3.17.0.3) - method_source (1.0.0) - multipart-post (2.3.0) - parallel (1.26.3) - parser (3.3.5.0) + json (2.15.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + method_source (1.1.0) + net-http (0.7.0) + uri + parallel (1.27.0) + parser (3.3.10.0) ast (~> 2.4.1) racc - pry (0.14.2) + prism (1.6.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.5) + public_suffix (6.0.2) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.1) rb-readline (0.5.5) - regexp_parser (2.9.2) - rexml (3.3.6) - strscan - rspec (3.13.0) + regexp_parser (2.11.3) + rexml (3.4.4) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.0) - rubocop (1.66.1) + rspec-support (3.13.6) + rubocop (1.81.7) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.3) - parser (>= 3.3.1.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.13.1) + simplecov-html (0.13.2) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - strscan (3.1.0) - unicode-display_width (2.5.0) - webmock (3.23.1) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.1.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) PLATFORMS aarch64-linux + arm64-darwin-24 x86_64-linux DEPENDENCIES diff --git a/lib/vmfloaty/http.rb b/lib/vmfloaty/http.rb index c1f03f6..4c19a20 100644 --- a/lib/vmfloaty/http.rb +++ b/lib/vmfloaty/http.rb @@ -37,7 +37,7 @@ def self.get_conn_with_auth(verbose, url, user, password) Faraday.new(url: url, ssl: { verify: false }) do |faraday| faraday.request :url_encoded - faraday.request :basic_auth, user, password + faraday.request :authorization, :basic, user, password faraday.response :logger if verbose faraday.adapter Faraday.default_adapter end diff --git a/vmfloaty.gemspec b/vmfloaty.gemspec index 184247b..8e8bcad 100644 --- a/vmfloaty.gemspec +++ b/vmfloaty.gemspec @@ -22,5 +22,5 @@ Gem::Specification.new do |s| s.require_path = 'lib' s.add_dependency 'commander', '>= 4.4.3', '< 4.7.0' - s.add_dependency 'faraday', '~> 1.5', '>= 1.5.1' + s.add_dependency 'faraday', '~> 2' end