39 Commits

Author SHA1 Message Date
Chris Roberts
513be177d3 Remove experimental checks
Removes experimental checks on existing experimental features.
2023-09-08 14:15:34 -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
Paul Hinze
2707d09181
Fix prepend/append action hooks firing multiple times
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.
2022-04-25 12:26:55 -05:00
Chris Roberts
157db39938 Remove action name tracking for applying
The raw action name tracking should be sufficient for preventing
multi-insertions where only a single modification should occur.
With action name, hooks _should_ be able to be applied in multiple
builder stacks as they are expanding.

Fixes #12035
2020-11-11 09:56:03 -08:00
Chris Roberts
30f8e7944d Track raw actions as they are applied to prevent multiple insertions
The raw actions are used for applying the original trigger behavior
which can insert before and/or after the entire set of actions. When
processing the stack items, mark when the raw action has been applied
to prevent it from being applied again. Triggers around the raw actions
should only ever be applied _once_.

Fixes #12034
2020-11-11 09:39:07 -08:00
Chris Roberts
db24f26daa Track application of action name hooks / triggers
When expanding stack track the origin action name and only apply
it once the stack has completed its expansion. The local env data
is marked with origin action to prevent it from being applied in
nested builders as they are expanded. The value of the stored action
name is checked and invalidated if another action is applied to the
same env in the future so hooks / triggers for that action are
applied as expected.
2020-11-02 10:39:15 -08: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
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
5d70cc3bf2 Retain original trigger behavior
These updates allow the after trigger to behave the same as the
original with regards to the execution location of the trigger
within the execution stack.
2020-04-03 15:47:00 -07:00
Chris Roberts
bcbbc825e0 Add test coverage on builder 2020-03-24 17:15:41 -07:00
Chris Roberts
4b65368852 Update builder to use generic trigger action 2020-03-23 17:10:17 -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
Thomas Linkin
d95b202346 Vagrant::Action::Builder RDoc correction
The RDoc comments for `Vagrant::Action::Builder#to_app` reference an
instance of `Vagrant::Action::Environment` as the passed paramter. There
is no class `Vagrant::Action::Environment` available. The param being
passed is actually a `Hash` that represents the "action environment".

This commit corrects the RDoc lines for
`Vagrant::Action::Builder#to_app` to correctly reference the passed
`Hash`.
2013-06-24 13:10:32 -04:00
Mitchell Hashimoto
f203c29fbb Builders are merged when using hooks. [GH-1555] 2013-04-07 14:17:40 -07:00
Mitchell Hashimoto
e5539eb769 Only prepend/append once for hooks 2013-03-30 14:57:47 -07:00
Mitchell Hashimoto
d720205810 Builder supports action hooks 2013-02-06 15:06:13 -08:00
Mitchell Hashimoto
50d7b0aba4 Fix bug where Call didn't propagate recovery. Warden has no recovery.
The issue here is that when a middleware failed and a recovery sequence
started, it would halt at the "call" step because the "Call" didn't
properly recover the child sequence.

An additional issue was that a Warden had no "recover" method, meaning
embedded Wardens wouldn't recover their stacks properly.
2012-12-23 16:29:25 -08:00
Mitchell Hashimoto
118377e6f0 Destroy sequence asks the user for confirmation. 2012-07-27 19:29:40 -07:00
Mitchell Hashimoto
556a53d48d You can no longer set env vars on Builders via use 2012-07-27 19:05:35 -07:00
Mitchell Hashimoto
5f8a654393 Goodbye, instance_eval on Vagrant::Action::Builder! 2012-07-26 22:00:25 -07:00
Mitchell Hashimoto
b7854c1ef6 Easy hooks 2012-05-05 22:31:21 -07:00
Mitchell Hashimoto
3d147f1d96 Raise exception if the insert_before middleware is not found 2012-05-05 22:10:26 -07:00
Mitchell Hashimoto
879f98b5d5 Action builder supports indexing middlewares by name 2012-05-05 22:01:53 -07:00
Mitchell Hashimoto
d80ff0a27f Pull out port collision detection/correction into the CheckPortCollision middleware 2011-12-25 10:13:08 -08:00
Mitchell Hashimoto
3cd262ed75 Unit tests for Vagrant::Action::Builder 2011-12-22 20:17:45 -08:00
Mitchell Hashimoto
b878f1bd66 class => module Action 2011-12-09 17:23:27 -08:00
Brian P O'Rourke
4e2472befc Typo fixes for docs 2010-12-14 22:06:15 -08:00
Mitchell Hashimoto
efbfd335ad Remove the ErrorHalt middleware, since Warden takes care of this on a larger scale 2010-08-27 23:50:14 -07:00
John Bender
2c1da9566c first pass at the action warden, currently just reproducing basic rack functionality 2010-08-22 00:08:54 -07:00
Mitchell Hashimoto
3d13a071c6 Allow setting environment on builder 2010-07-13 21:31:06 -07:00
Mitchell Hashimoto
086ca5a97e Builder#use returns self, for chaining 2010-07-07 21:00:54 -07:00
Mitchell Hashimoto
68f1e6c7e1 Make mergeable default behaviour and make flatten the explicit behavior 2010-07-06 20:50:35 -07:00
Mitchell Hashimoto
3c943834ea Builder can now use other builders or merge other builders 2010-07-06 20:08:36 -07:00
Mitchell Hashimoto
29458061df Added insert, swap, and delete helpers to Vagrant::Action::Builder 2010-07-05 20:09:39 +02:00
Mitchell Hashimoto
05a01f5953 Added ErrorHalt middleware which is prepended to all builder actions 2010-07-04 18:15:41 +02:00
Mitchell Hashimoto
5775292408 Registered actions can be run. Builders can use other builders 2010-07-04 04:09:02 +02:00
Mitchell Hashimoto
bad5ba559f Actions on Environment and making them runnable 2010-07-04 03:48:16 +02:00
Mitchell Hashimoto
c88adbc0f7 Builder fully tested 2010-07-03 18:51:40 +02:00
Mitchell Hashimoto
6eefc8e874 Initial foundation building of new action style 2010-07-03 17:34:15 +02:00