30 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
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
cba5bca7de Use variable when sending info to logger 2020-11-02 10:31:28 -08:00
Chris Roberts
217f2530db Use machine specific triggers instance when machine is available in runner 2020-03-26 17:20:55 -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
Brian Cain
ee985f9f7f
Fix typo in UI Prefix for trigger UI 2019-03-21 10:11:38 -07:00
Chris Roberts
7e47602e3d Wrap output in thread when being called from within trap-context
This prevents a ThreadError exception being raised on sigint which
resulted in a stacktrace being dumped.
2019-02-12 16:06:16 -08:00
Brian Cain
071d8b09cd
Add machine for hook and action triggers 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
Paul Hinze
dfbcebef0b core: log action name to info
I found this output to be very helpful in debugging an action hook
problem in a plugin.  problem. I'm not sure why the callable_id is
useful (seem to always show up as an instance of `Builder` or `Warden`
for me), but I left it in there just in case it's useful to someone.
2015-01-24 09:59:48 -08:00
Seth Vargo
d2874064f4 Use .key? instead of .has_key? 2015-01-05 18:29:01 -05:00
Mitchell Hashimoto
92df8cf6ae Handle a lot of TODOs 2014-04-29 16:50:58 -07:00
Mitchell Hashimoto
1550946b0c core: build action builder if responds to call 2013-12-03 11:43:38 -08:00
Fabio Rehm
ae472dece9 core: Fix hooking when using a Method object as a callable on action runner 2013-12-02 22:53:59 -02:00
Mitchell Hashimoto
be01d57034 action_hooks can hook into specific actions 2013-02-22 12:12:55 -08:00
Mitchell Hashimoto
cd3d2a1e8c Call properly modifies original environment 2013-02-06 18:36:05 -08:00
Mitchell Hashimoto
352fec0359 Fix some issues to get hooks working 2013-02-06 15:42:48 -08:00
Mitchell Hashimoto
b20dcc9eb8 Setup hooks in the runner 2013-02-06 15:37:12 -08:00
Mitchell Hashimoto
118377e6f0 Destroy sequence asks the user for confirmation. 2012-07-27 19:29:40 -07:00
Mitchell Hashimoto
90517a0f9b The Call built-in middleware allows for conditional MW sequences.
Read the documentation for more information.
2012-07-26 23:56:47 -07:00
Mitchell Hashimoto
2ef20586da Remove the action registry feature.
This can be removed since in the future all actions will come from the
providers or something. There are still issues with box actions but
we'll get back to that later...
2012-07-26 21:57:11 -07:00
Mitchell Hashimoto
134e56db21 Reference proper constant ALL_ACTIONS 2012-06-27 11:16:04 -07:00
Mitchell Hashimoto
b7854c1ef6 Easy hooks 2012-05-05 22:31:21 -07:00
Mitchell Hashimoto
8850c086b1 Plugins can now have action_hooks 2012-05-05 18:28:07 -07:00
Mitchell Hashimoto
3cd262ed75 Unit tests for Vagrant::Action::Builder 2011-12-22 20:17:45 -08:00
Mitchell Hashimoto
739d5ffb5f Lazy load attributes for runners. Get box repackage working. 2011-12-09 20:24:34 -08:00
Mitchell Hashimoto
b878f1bd66 class => module Action 2011-12-09 17:23:27 -08:00
Mitchell Hashimoto
0304f78a84 Fix to runner to get interrupts working again 2011-12-09 14:56:56 -08:00
Mitchell Hashimoto
b31c3d458c Action runner supports global parameters 2011-12-09 14:44:43 -08:00
Mitchell Hashimoto
daf711fd80 Separate Vagrant::Action into Runner and Registry 2011-12-09 14:22:03 -08:00