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
This unpins Faraday and webmock, and updates specs so that the Faraday changes (primarily including auth in the header rather than in the URL) is reflected.
This commit bumps the commander version up to 4.4.3 in order to clear
up the deprecation warnings being emitted from 4.3.0:
```
> floaty get centos-7-x86_64
/Users/highb/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/commander-4.3.8/lib/commander/user_interaction.rb:333:
warning: constant ::NIL is deprecated
/Users/highb/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/commander-4.3.8/lib/commander/user_interaction.rb:333:
warning: constant ::TRUE is deprecated
/Users/highb/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/commander-4.3.8/lib/commander/user_interaction.rb:333:
warning: constant ::FALSE is deprecated
/Users/highb/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/commander-4.3.8/lib/commander/user_interaction.rb:333:
warning: constant ::Fixnum is deprecated
/Users/highb/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/commander-4.3.8/lib/commander/user_interaction.rb:333:
warning: constant ::Bignum is deprecated
- as9r7rigltr70zt.delivery.puppetlabs.net (centos-7-x86_64)
```
Instead of having a hardcoded version identifier in multiple
locations, we can leverage the Classname::VERSION pattern to have a
single canonical version number that everything can reference
programmatically.
Pessimistic versioning means that Faraday 0.11.0 will be installed if
the constraint is "~> 0.9", and that will break spec tests due to
newer restrictions in Faraday around how HTTP requests are handled by
rspec. We don't want to break tests.
Prior this commit, some commands did not accept some options as an
argument and instead only worked through a flag. This commit updates
that behavior to allow users to specify some options through arguments,
while leaving the ability to continue to specify those options through
flags. Command line arguments take precedence over flags. It also fixes
an issue where if a snapshot sha was nil, it would submit a request to
take a snapshot to vmpooler.
This commit cleans up the Auth class so that it no longer system exits
if an error occurs. Instead it will return nil if it could not properly
make the request, and it's on the consumer of the class to handle
error cases.
This commit updates floaty to use a new endpoint to modify vms. Now you
can use the modify command to extend the disk space of a given vm. The
downside is this new endpoint only exists at /api/v1 on the pooler, and
the way Faraday works required an update to removing a leading slash for
each request endpoint. Users should update their URL in the floaty dot
file to include a /api/v1 at the end of the pooler url
This commit changes the get command to have users request vms by
specifying the hosts they want and then the number of hosts rather than
having to say each one separated by a comma.