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.
2.2 KiB
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| docs | Vagrant Triggers Configuration | triggers-configuration | Documentation of various configuration options for Vagrant Triggers |
Configuration
Vagrant Triggers has a few options to define trigger behavior.
Options
The trigger class takes various options.
-
action(symbol, array) - Expected to be a single symbol value, an array of symbols, or a splat of symbols. The first argument that comes after either before or after when defining a new trigger. Can be any valid Vagrant command. It also accepts a special value:allwhich will make the trigger fire for every action. An action can be ignored with theignoresetting if desired. These are the valid action commands for triggers:destroyhaltprovisionreloadresumesuspendup
-
ignore(symbol, array) - Symbol or array of symbols corresponding to the action that a trigger should not fire on. -
info(string) - A message that will be printed at the beginning of a trigger. -
name(string) - The name of the trigger. If set, the name will be displayed when firing the trigger. -
on_error(symbol) - Defines how the trigger should behave if it encounters an error. By default this will be:halt, but can be configured to ignore failures and continue on with:continue. -
only_on(string, regex, array) - Limit the trigger to these guests. Values can be a string or regex that matches a guest name. -
run_remote(hash) - A collection of settings to run a inline or remote script with on the guest. These settings correspond to the shell provisioner. -
run(hash) - A collection of settings to run a inline or remote script on the host. These settings correspond to the shell provisioner. However, at the moment the only settingsruntakes advantage of are:argsinlinepath
-
warn(string) - A warning message that will be printed at the beginning of a trigger. -
exit_codes(integer, array) - A set of acceptable exit codes to continue on. Defaults to0if option is absent. For now only valid with therunoption.