The fake_ftp patches should only be applied when running tests. Since
the library is a development dependency only, it will not be available
for loading from a release.
Instead of having to update these flavor.rb files every time a
new version of CentOS/RHEL come out let's dynamically pick up
the version (7,8,9) from the machine.
This was inspired slightly by the Rocky Linux guest flavor.rb.
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.
Executing the `vagrant` in the path was yielding an error:
> Could not locate Gemfile or .bundle/ directory
Traced it back to this gem making every ruby binary into a bundler shim
The "destroy_on_error" functionality for `vagrant up` is implemented in
the `recover()` action chain, and works by firing off a destroy action
from inside that chain.
This is all well and good, but it copies its existing `env` which has
had `action_name` set for the up action. This was causing action_hooks
for up actions to attach to this destroy action stack.
Setting the action_name explicitly in the env before firing the runner
should correct the behavior. I'm not sure if raw_action_name is used
anywhere but I figured it was better to be consistent vs conservative in
what we change.
This addresses the surprising behavior that the StoreBoxMetadata hook
was running many times during a machine up, including during failed
operations where a destroy_on_error deleted the machine. This was
resulting in an error that looked like:
> No such file or directory @ rb_sysopen [...] /[...]/box_meta
Plugin action hooks using prepend/append were attaching every time a
Builder was run, including sub-Builders that show up for things like
Call actions.
To fix this, we tell Builders if they are "primary" and only run
prepend/append on those. See inline comments for more explanation.
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!
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)
There was a hash assignment that was overriding values when there were
multiple synced folders for a given implementation.
Includes some stub-tastic unit tests to help verify the hash munging
behavior does what it's supposed to do going forward.
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!