41 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
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
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
57c4de49f2
Remove "command" string from logger
Since not all triggers are commands, removing the word `command` from
the logger so it is not confused with other types of triggers.
2019-05-13 13:26:47 -07:00
Brian Cain
659aa1c48e
Remove todo in validation 2019-02-01 13:34:15 -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
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
Brian Cain
72f3a7be14
Ensure the SecureRandom library is loaded 2018-07-27 13:44:24 -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
a9be56b356
Code updates based on PR feedback 2018-04-24 10:04:40 -07:00
Brian Cain
e25cb51f15
Properly print warnings on config settings that aren't supported 2018-04-20 10:51:38 -07:00
Brian Cain
12b1a3dfe4
Update triggers based on code review 2018-04-20 10:51:38 -07:00
Brian Cain
e0806f623c
Remove TODO 2018-04-20 10:51:38 -07:00
Brian Cain
767a315393
Trigger cleanup 2018-04-20 10:51:38 -07:00
Brian Cain
693eb2fbbb
Add machine level warning when privileged option is set for run 2018-04-20 10:51:38 -07:00
Brian Cain
3ad4f576c0
Add only_on validation for config 2018-04-20 10:51:38 -07:00
Brian Cain
ca672eb8e6
Trigger plugin cleanup 2018-04-20 10:51:38 -07:00
Brian Cain
85dedf25d9
Ensure that :all triggers don't get filtered out 2018-04-20 10:51:38 -07:00
Brian Cain
2c30eab723
Don't run local commands as sudo by default 2018-04-20 10:51:38 -07:00
Brian Cain
eac2fcf71e
Filter triggers based on only_on restraint 2018-04-20 10:51:38 -07:00
Brian Cain
a5d8cc1caa
Update trigger classes with comments 2018-04-20 10:51:38 -07:00
Brian Cain
abb6d77442
Move location of command validator 2018-04-20 10:51:38 -07:00
Brian Cain
6cbb5d8e5d
Add unit tests for config, fix type change bug with map! 2018-04-20 10:51:38 -07:00
Brian Cain
42419bbd49
Fix rspec tests 2018-04-20 10:51:38 -07:00
Brian Cain
d0d69e59c9
Update return doc string on validate 2018-04-20 10:51:38 -07:00
Brian Cain
60c4ffa8a6
Ensure run & run_remote are Hashes before updating to shell config 2018-04-20 10:51:38 -07:00
Brian Cain
e752878de9
Update finalize method for run and run_remote objects 2018-04-20 10:51:38 -07:00
Brian Cain
d3dde739fe
Update trigger code docs 2018-04-20 10:51:38 -07:00
Brian Cain
1591ae9916
Make run and run_remote settings shell provisioner configs 2018-04-20 10:51:38 -07:00
Brian Cain
0cbf6970fc
Update config class setting 2018-04-20 10:51:38 -07:00
Brian Cain
d26a925bd7
Update variable doc 2018-04-20 10:51:38 -07:00
Brian Cain
5ca1d1ab64
Finalize config in plugins finalize, improve docs 2018-04-20 10:51:38 -07:00
Brian Cain
b04f13657b
Move warning to logger rather than guest 2018-04-20 10:51:38 -07:00
Brian Cain
a96baad0d7
Add comments for later dev 2018-04-20 10:51:38 -07:00
Brian Cain
60ff2489c4
Display warning if vagrant command for trigger is not found 2018-04-20 10:51:38 -07:00
Brian Cain
8e72ae5bd6
Add basic validation for trigger config objects 2018-04-20 10:51:38 -07:00
Brian Cain
e0a5b1d647
Parse block trigger configs 2018-04-20 10:51:38 -07:00
Brian Cain
6f00eb5679
Move trigger options into own plugin class 2018-04-20 10:51:38 -07:00