130 Commits

Author SHA1 Message Date
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
Paul Hinze
ff86d86ac8
Provisioner Plugins 2022-04-25 12:26:37 -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
sophia
5607428a66 Don't try to recover machine without a uuid 2020-09-15 11:16:13 -05:00
sophia
943047d003 Add tests for synced folder collections 2020-08-19 17:57:57 -05:00
sophia
faad9f2717 Add tests 2020-08-19 15:00:40 -05:00
Chris Roberts
5003bb6e15 Updates to address all Ruby deprecations and warnings
This includes updates for resolving all warnings provided by Ruby
for deprecations and/or removed methods. It also enables support
for Ruby 2.7 in the specification constraint as all 2.7 related
warnings are resolved with this changeset.
2020-08-10 13:05:41 -07:00
sophia
1661d1f1cf Print help message if user provides and ambiguous option 2020-07-06 10:52:05 -05:00
Chris Roberts
f26440ee38 Only allow the all special value to be matched when requested
This prevents the all special value from being matched on the
non-defined raw action names when the typed triggers support
is enabled.
2020-06-12 17:09:31 -07:00
Chris Roberts
916655dbd3 Fix trigger matching on :all special value
Updates the type to do a proper comparison when checking for
the `:all` special value as well as applied ignores.

Fixes #11599
2020-06-09 16:12:48 -07:00
Chris Roberts
5195bee9ea Check if plugin install provides specification
During a plugin install, if the plugin is already installed and
activated, no specification will be returned as there was nothing
new installed. In this situation, look for the requested plugin
within the activated specifications. If it is found, then proceed
since the plugin is installed. If it is not found, return an error.
2020-05-06 15:51:37 -07:00
Chris Roberts
d08c68ecf3 Adjust how trigger actions are inserted into the stack
This adjusts how triggers are implemented during a normal run. Any
defined triggers which are applicable are located and injected into
the run stack as the stack is built, including hook type triggers.

Support is included for dynamic hook lookup.

The data type used when defining triggers has also been relaxed to
support symbols, strings, or constants.
2020-03-17 15:07:36 -07:00
Chris Roberts
9336ca5529
Merge pull request #11363 from chrisroberts/enhancement/solutions
Add support for caching solutions. Remove GEMRC modifications.
2020-03-10 14:42:28 -07:00
Chris Roberts
3686aed72d Add test coverage for dynamic action hook support 2020-03-03 16:23:31 -08:00
Chris Roberts
21c1bb5e05 Add support for caching solutions. Remove GEMRC modifications.
This pull request adds an enhancement to the internal Bundler class
to cache solution sets. This prevents Vagrant from generating a
solution for configured plugins on every run. Modifications to
the configured plugin list (global or local) will result in the
cached solution being invalidatd and resolved again.

Also included is the removal of the GEMRC modifications required
for Windows.
2020-02-03 07:43:17 -08:00
Chris Roberts
88c675694a Update trigger abort behavior when running parallel actions
When the provider supports parallel actions and actions are being
run in parallel, do not immediately kill the process on failure.
Instead terminate the action thread and log the exit code. Once
all running actions have completed, the process will then exit
with the stored exit code.
2019-06-04 16:40:59 -07:00
Brian Cain
eb3e309f89
Ensure guest names are string when filtering
Prior to this commit, if a guest name was given as a symbol, the
filter_triggers method would fail to properly match it with the only_on
option, as it is not a valid type to the #String.match method. This
commit fixes that by converting the parameter to a string so that it can
be properly matched on the guest.
2019-05-13 14:07:22 -07:00
Brian Cain
35ee3e2342
Fixes #10823: Use Process.exit! for abort trigger option
Prior to this commit, the `abort` option for triggers would just call
`exit`, which would end up raising a SystemExit exception, signaling
Vagrant to abort. This broke down however in a multithreaded context
like when running multiple guests at once on supported providers,
resulting in Vagrant failing to exit cleanly and instead raise an
exception. This commit changes that by instead using `Process.exit!` to
abort Vagrant.
2019-05-03 14:48:54 -07:00
Brian Cain
16b5ad74ca
Handle command triggers with run_remote options
This commit adds some handling around when a machine does not exist at
all but a trigger was defined with a run_remote option
2019-02-01 13:34:15 -08:00
Brian Cain
fefb702359
Introduce type and command triggers
This commit introduces some basic functionality for typed triggers:

- command
- action

Command triggers are triggers that will run before or after a given
sub-command.

Action triggers are for running triggers before or after internal
actions for Vagrant. This could be before or after a provision step,
before or after synced folders, or networking, etc.
2019-02-01 13:34:15 -08:00
Brian Cain
69b3b44505
Fixes #10393: Only use Shellwords on non-windows hosts
This commit updates how the trigger `run` inline option works by only
applying `Shellwords.split` to the inline command if it is going to be
run on non-Windows hosts. Otherwise pass the inline script directly to
be executed by Powershell.
2018-11-13 13:07:39 -08:00
Brian Cain
f4d618eb58
Fixes #9840: Introduce ruby option for trigger
This commit introduces a new option to the core trigger feature: `ruby`.
It can be defined to run ruby code when the trigger is configured to
fire. If you give the ruby block an env and machine argument, the
defined ruby code can use those variables internally.
2018-10-05 12:53:41 -07:00
Brian Cain
58ebd52f99
Add abort option to core triggers
This commit adds a new option `abort`, which when configured, will exit
the Vagrant process completely. If set to `true`, it will exit cleanly
with exit code 0. Otherwise, the exit code can be configured.
2018-09-25 09:40:36 -07:00
Chris Roberts
3ace82cc5b Update Vagrant.has_plugin? helper to function prior to plugin loading
Due to the Vagrantfile being loaded prior to plugin loading to determine
project local plugin information the Vagrant.has_plugin? helper will always
return false when the Vagrantfile is first loaded. To prevent this behavior
we can check for plugins in the plugin data files prior to the plugins
being loaded, and after they have been loaded we can fallback to the
original specification based check.
2018-08-31 14:03:42 -07:00
Brian Cain
5723c7181a
Add test for trigger run path with spaces 2018-08-17 15:17:49 -07:00
Brian Cain
8bce4f3828
Update tests to include passed in arg values 2018-08-14 13:24:42 -07:00
Brian Cain
29aba535ce
(#10104) Ensure trigger run args are an array prior to join
Prior to this commit, if the args key was a string rather than an array
of strings, the `join` command would fail when appending the arguments
to the run command for a given script. This commit updates that by
ensuring the `args` option is an array prior to joining the arguments.
2018-08-14 10:29:51 -07:00
Chris Roberts
3e22764ac8 Add test coverage on globalize and localize within plugin manager 2018-07-18 10:48:57 -07:00
Chris Roberts
3223737734 Use env_local consistently internally 2018-07-17 14:49:41 -07:00
Chris Roberts
84c0aafe71 Support non-interactive local plugin install 2018-07-17 14:49:41 -07:00
Brian Cain
52c3dcc70e
(#9997) Catch and allow for non-standard exit codes
Prior to this commit, the run trigger option wouldn't catch for failures
outside of the #Subprocess.execute raising exceptions. This commit fixes
that by inspecting the exit code result of the subprocess and using the
new `exit_codes` option to determine how to move forward with the
trigger.
2018-07-09 15:56:26 -07:00
Brian Cain
2000a11042
Add tests for powershell run functions 2018-04-20 10:51:38 -07:00
Brian Cain
e7d07cb110
Add rspec tests for trigger plugin 2018-04-20 10:51:38 -07:00
Brian Cain
6ea7819402
Update rspec tests for trigger plugin 2018-04-20 10:51:38 -07:00
Brian Cain
fbad4c749d
Add basic spec test for trigger class 2018-04-20 10:51:38 -07:00
Brian Cain
8b1043c199 Remove stub methods and replace with allows for rpsec 3 2017-08-04 15:02:59 -07:00
Chris Roberts
1a62743bc5 Update rspec to recent version and fix deprecations 2017-08-03 17:54:07 -07:00
Chris Roberts
97715280c2 Deep merge plugin list with system plugins. Discard specifications correctly. 2017-06-27 19:05:30 -07:00
Chris Roberts
cf93efca2d Update tests for new information and cleaning method 2016-11-16 13:27:34 -08:00
Chris Roberts
3afa7a3193 Update specs to match updated behavior for local install 2016-11-11 15:21:30 -08:00
Chris Roberts
1f5dd35d16 Remove bundler where no longer required 2016-11-07 20:00:38 -08:00
Seth Vargo
fb60d34236
Add unique names to all tmpdir and tempfile calls in tests + cleanup
This commit attempts to uniquely identify the temporary files and
directories that are created during test runs. Where it was a quick
fix, this commit also removes the temporary files and directories.

There are still a ton of temporary files due to calls to
.isolated_environment in the tests without an easy API an easy way
to provide a closer to that function.
2016-05-28 23:22:34 -04:00
Mitchell Hashimoto
85f1e05e2a core: prune machine if non-existent CWD from index [GH-4742] 2015-11-18 15:48:59 -08:00
Mitchell Hashimoto
69d9bc0fe8 Environment can_install_provider and install_provider 2015-11-05 11:50:10 -08:00
Mitchell Hashimoto
e759df11a0 core: fix crash for missing options [GH-5550] 2015-07-06 10:36:41 -06:00
Seth Vargo
f3c35855f0 Add a newline because #ocd 2014-12-08 11:35:11 -08:00
Seth Vargo
7f6a4fa3bd Add tests for plugin manager push_configs 2014-12-08 11:35:11 -08:00
Seth Vargo
60a8472891 Use a pushes registry instead of data hash 2014-12-08 11:35:09 -08:00
Matt Wrock
dc628cd722 fixes infinite loop in machine state call if provider calls machine.action 2014-11-06 08:51:47 -08:00
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00