Commit graph

216 commits

Author SHA1 Message Date
Chris Roberts
6e13612111 Add test coverage for architecture support 2023-09-14 16:15:03 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
Chris Roberts
0a20379b1a Enable deprecated key type and host key algorithm
Recent versions of OpenSSH remove support of ssh-rsa key types and host
key algorithms from the default conection configuration. Set options to
enable them and provide a configuration option which can disable them if
required.
2023-05-22 17:09:47 -07:00
Dan Čermák
73ee447c87 Stop using the last argument as kwargs in unit tests
A few unit tests started failing with Ruby 3.0, because they were relying on
keyword arguments being converted into hashes automatically. This behavior was
deprecated in Ruby 2.7 and results in errors in Ruby 3.0 onward.

For further details:
https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
2022-07-28 14:45:47 -05:00
sophia
5709027c45 Update mapper tests for not returning HashWithIndifferentAccess 2022-07-01 13:56:50 -05:00
sophia
0372da5f5f Update mapper tests for hash with indifferent access 2022-06-29 16:43:19 -05:00
sophia
df8f519337 Fix guest and host service tests 2022-06-29 16:01:40 -05:00
Paul Hinze
f07ba964d3
Prevent autocomplete install test from messing with real homedir
It just so happens my `~/.bashrc` is not writable by my user (NixOS
humblebrag lol) so this test fails for me locally.

Turns out the test was touching the user's homedir which we probably
don't want anyways, so stub out a tempdir instead.
2022-04-25 14:24:06 -05:00
Chris Roberts
46efcb8af8
Fix hash usage in mapper test 2022-04-25 12:26:56 -05:00
Paul Hinze
1341bfe0af
Tweak Ruby->Go error handling so exit codes match
In legacy Vagrant, any exception raised that's a subclass of
Vagrant::Errors::VagrantError is considered user-facing and so causes
the error message to be printed to the console and the process to use
exit code 1. Anything outside of that causes the process to use exit
code 255. (See `bin/vagrant` for the code.)

Here we mirror that behavior by treating errors that have a
LocalizedMessage as user-facing and those without as unexpected. This
allows the basic virtualbox component to pass in vagrant-spec!
2022-04-25 12:26:49 -05:00
Paul Hinze
06ad1b4565
Fixup tests for Ruby 3.0
This is a pass through test failures and deprecation warnings:

 * Make all ambiguous `.with(..., key: val)` use explicit hashes to
   prevent test failures for argument mismatch in Ruby 3.0
 * Scope down all unbounded `raise_error` to address warnings (remove
   one test that was revealed to be referencing a nonexistent variable
   once the raise_error was scoped.)
 * Update all `any_instance` usage to new syntax to address warnings
 * Allow the service cache to be cleared and do so between some tests
 * Fix a small bug in with_plugin's plugin not found code path (revealed
   by a scoped and_raise)
2022-04-25 12:26:40 -05:00
Paul Hinze
8730b9f100
Fix MachineState mapper so IsRunning actions work
The IsRunning action checks if `env[:machine].state.id == :running` but
this check was never passing as the protobuf-washed version of machine
state was yielding a machine state w/ a string value like `"running"`.

Easy fix in the mapper!
2022-04-25 12:26:34 -05:00
sophia
ea778c188d
Update ruby tests 2022-04-25 12:26:28 -05:00
Paul Hinze
a86965c340
ruby mappers: Unwrap wrapper types in Hashes and Arrays
Boolean types (and possibly a few others) are returned as wrapper
classes when coming out from proto mapping; these need to be unwrapped
otherwise the caller who is expecting a nice clean boolean value ends up
with an icky protobuf class.

This fixes the shell provisioner, which relies on a communicator
receiving a settings hash `{error_check: false}` for a command that
usually fails but it sent just in case before provisioning starts.
2022-04-25 12:26:23 -05:00
sophia
53f7b3f8eb
Update tests for GRPC errors 2022-04-25 12:26:20 -05:00
Chris Roberts
820118b481
Prevent GRPC connection in tests 2022-04-25 12:26:16 -05:00
Chris Roberts
59144f74d3
Stub out mapper response to return machine 2022-04-25 12:26:01 -05:00
sophia
c6070c69db
Rename cap command 'target' to 'target-guest'
the target name is already used by the go cli
2022-04-25 12:24:49 -05:00
sophia
b1f495315e
Fix tests 2022-04-25 12:24:49 -05:00
sophia
ca824644a5
Add tests for host service 2022-04-25 12:24:41 -05:00
sophia
434e613856
Test has capability 2022-04-25 12:24:39 -05:00
sophia
7477455380
Get parents from guest plugin 2022-04-25 12:24:39 -05:00
sophia
493343abb6
Add test guest 2022-04-25 12:24:38 -05:00
sophia
7fe582037f
Add a few tests for detection of guests 2022-04-25 12:24:38 -05:00
sophia
34637c616e
Add tests for guest service parents 2022-04-25 12:24:38 -05:00
Chris Roberts
3d0d0148e9 Update tests to use real UI instance
Replaces use of UI doubles within tests to use actual UI instance
    to ensure calls are passing parameters correctly.
2021-06-23 14:04:48 -07:00
Chris Roberts
eae6c1d022
Merge pull request #12419 from chrisroberts/fix-local-box-add
Fix local box add with relative path on Windows
2021-06-22 15:45:49 -07:00
Chris Roberts
e7a6f397da Updates for Ruby 3.0 2021-06-21 15:57:46 -07:00
Chris Roberts
218f8323fb Return original when access token is not removed
When scrubbing box urls of access token parameters, only return
    the processed URL if the access token was removed. If it was not
    removed, return the original URL string. This prevents issues with
    local file URLs being parsed and replaced with invalid paths.

    Fixes: #12340 #12350 #12320
2021-06-11 16:59:35 -07:00
Ikko Ashimine
ddb3994c25
Fix typo in publish_test.rb
vesion -> version
2021-03-27 11:34:15 +09:00
Chris Roberts
cf51c18ad8 Update authentication middleware access token handling
Replace the `VAGRANT_ALLOW_PARAM_AUTH_TOKEN` environment variable
    with `VAGRANT_SERVER_ACCESS_TOKEN_BY_URL` and update the behavior
    when the environment variable is set to add the access token as
    a query parameter and disable the addition of the authentication
    header.

    Fixes #12080
2021-03-24 17:24:47 -07:00
Chris Roberts
fd4da92245 Check file size prior to upload and automatically adjust options
When uploading box file, check if the size is greater than
    5GB. If the size is larger and the direct to storage option
    is enabled, disable the option due to current 5GB restriction
    on direct uploads.
2021-03-23 15:11:32 -07:00
Chris Roberts
60323fdd6c
Merge pull request #12235 from chrisroberts/api-notify-ups
Prevent notification on default store, fix client end point
2021-03-17 13:57:47 -07:00
Chris Roberts
3316098bb6 White space trim 2021-03-17 13:08:30 -07:00
Chris Roberts
d580fbbee2 Use the server url helper method within the client
Some client setup locations where not using the custom helper
    method for the vagrant server URL value so they have been
    updated. The api path is also appended if it is not set for
    custom server URLs
2021-03-15 17:17:10 -07:00
Chris Roberts
867d65b079 Remove access token parameter if found on URL 2021-03-15 15:17:48 -07:00
Chris Roberts
51382a0d0a Deprecate hook and disable access token parameter by default
This sets the `authenticate_box_url` hook as deprecated and also
    disables the cloud auth middleware from adding an access token
    as a URL parameter by default. An environment variable has been
    added which can be used for re-enabling the access token URL
    parameter behavior if required for some legacy system which does
    not support the authorization header.
2021-03-15 14:46:46 -07:00
Sophia Castellarin
ade9ecdde7
Merge pull request #12186 from soapy1/vagrant-destroy-exit-code
Don't count not created machines as declined when destroying
2021-03-08 13:54:03 -06:00
Sophia Castellarin
d111596446
Merge pull request #12188 from soapy1/vagrant-does-not-reference-empty-string-vm
Don't try to find "" by prefix in the machine index
2021-02-23 14:24:17 -06:00
sophia
a2fdbc5625 Don't count not created machines as declined when destroying 2021-02-22 16:14:16 -06:00
sophia
ab1c3c2547 Don't try to find "" by prefix in the machine index 2021-02-11 15:59:15 -06:00
sophia
ccbdcd46d0 Fix minimal Vagrantfile test
A minimal Vagrantfile may set the vi mode for ruby
2021-02-10 11:34:50 -06:00
Chris Roberts
4253f27901 Prevent printing token warning more than once
Mark warning of double tokens set when initially print to prevent
the warning from being shown multiple times during a single run.
2020-11-03 13:47:53 -08:00
Chris Roberts
8b0790168b Check for filter versions and break up box output 2020-10-30 09:26:07 -07:00
Chris Roberts
baa24af179 Remove all unused code related to the deprecated login command 2020-10-30 09:26:07 -07:00
Chris Roberts
78d309a09b Update cloud command to use refactored library implementation
This PR is dependent on the 2.1.0 release of the vagrant_cloud
library. It updates the `cloud` command to use the new interface
for interacting with the Vagrant Cloud API. It also adds support
for direct to backend storage uploads, and defaults to this
method.

Also included is a bit of cleanup refactoring, addition of method
documentation, and fixing up some small issues around custom username
usage within the internal client for authentication.
2020-10-30 09:26:07 -07:00
sophia
dfb0c3dde1 Add ability to specify target for cap command 2020-10-14 17:34:40 -05:00
Sophia Castellarin
70d37e8a9c
Merge pull request #11835 from soapy1/remove-url-token
Download a box by setting auth headers
2020-09-22 15:35:30 -05:00
Chris Roberts
4b07f2d1fa
Merge pull request #11912 from kipal/assume-yes-cloud-version-release
--yes options added to CloudCommand::VersionCommand::Command::Release
2020-09-22 11:38:48 -07:00
Nandor Kiss
cc3cdfe452 --force instead of --yes. 2020-09-22 20:13:30 +02:00