Update trigger config docs
This commit is contained in:
parent
071d8b09cd
commit
c4a03e594f
|
@ -18,7 +18,7 @@ should fire:
|
||||||
* `before`
|
* `before`
|
||||||
* `after`
|
* `after`
|
||||||
|
|
||||||
These define _how_ the trigger behaves and determines when it should fire off during
|
These define _how_ the trigger behaves and when it should fire off during
|
||||||
the Vagrant life cycle. A simple example of a _before_ operation could look like:
|
the Vagrant life cycle. A simple example of a _before_ operation could look like:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -27,8 +27,9 @@ config.trigger.before :up do |t|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
Triggers can be used with [_actions_](#actions), [_hooks_](#hooks), or [_commands_](#commands),
|
Triggers can also be used with [_actions_](#actions), [_hooks_](#hooks), or [_commands_](#commands),
|
||||||
but by default will be defined to run before or after a Vagrant guest.
|
but by default will be defined to run before or after a Vagrant guest. For more
|
||||||
|
detailed examples of how to use triggers, check out the [usage section](/docs/triggers/usage.html).
|
||||||
|
|
||||||
## Trigger Options
|
## Trigger Options
|
||||||
|
|
||||||
|
@ -81,28 +82,23 @@ The trigger class takes various options.
|
||||||
|
|
||||||
## Trigger Types
|
## Trigger Types
|
||||||
|
|
||||||
Optionally, it is possible to define a trigger that executes around Vagrant subcommands
|
Optionally, it is possible to define a trigger that executes around Vagrant subcommands,
|
||||||
and actions.
|
hooks, and actions.
|
||||||
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<strong>Warning!</strong> This feature is still experimental and may break or
|
<strong>Warning!</strong> This feature is still experimental and may break or
|
||||||
change in between releases. Use at your own risk.
|
change in between releases. Use at your own risk.
|
||||||
|
|
||||||
This feature was introduced at TODO FIX ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
This feature currently reqiures the experimental flag to be used. To explicitly enable this feature, you can set the experimental flag to:
|
||||||
and currently reqiures the experimental flag to be used. To explicitly enable this feature, you can set the experimental flag to:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
VAGRANT_EXPERIMENTAL="typed_triggers"
|
VAGRANT_EXPERIMENTAL="typed_triggers"
|
||||||
```
|
```
|
||||||
|
|
||||||
TODO ADD DOCS PAGE!!!11
|
Please note that `VAGRANT_EXPERIMENTAL` is an environment variable. For more
|
||||||
`VAGRANT_EXPERIMENTAL` is an environment variable. For more information about this flag
|
information about this flag visit the [Experimental docs page](/docs/experimental/)
|
||||||
please visit the docs page for more info.
|
for more info. Without this flag enabled, triggers with the `:type` option
|
||||||
|
will be ignored.
|
||||||
Without this flag enabled, triggers with the `:type` option will be ignored.
|
|
||||||
|
|
||||||
Vagrantfiles with the `:type` option for triggers will result in an error if
|
|
||||||
used by older Vagrant versions.
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,11 +116,21 @@ config.trigger.after :destroy, type: :command do |t|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
__Note:__ Triggers _without_ the type option will run before or after a
|
#### Quick Note
|
||||||
Vagrant guest. These most similarly align with the `:action` type, and by default
|
|
||||||
are classified internally as an action.
|
|
||||||
|
|
||||||
TODO: ADD INFO ABOUT GUARDING TYPE OPTION WITH VAGRANT VERSION CHECK IN VAGRANTFILE FOR OLDER CLIENTS
|
Triggers _without_ the type option will run before or after a Vagrant guest.
|
||||||
|
|
||||||
|
Older Vagrant versions will unfortunetly not be able to properly parse the new
|
||||||
|
`:type` option. To prevent older clients from failing to parse your Vagrantfile,
|
||||||
|
you can guard the new trigger based on the version of Vagrant:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
if Vagrant.version?(">= 2.3.0")
|
||||||
|
config.trigger.before :status, type: :command do |t|
|
||||||
|
t.info = "before action!!!!!!!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
||||||
|
@ -143,14 +149,28 @@ command.
|
||||||
|
|
||||||
### Hooks
|
### Hooks
|
||||||
|
|
||||||
|
TODO: This still needs to be filled in.
|
||||||
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<strong>Advanced topic!</strong> This is an advanced topic for use only if
|
<strong>Advanced topic!</strong> This is an advanced topic for use only if
|
||||||
you want to execute triggers around Vagrant hooks. If you are just getting
|
you want to execute triggers around Vagrant hooks. If you are just getting
|
||||||
started with Vagrant and triggers, you may safely skip this section.
|
started with Vagrant and triggers, you may safely skip this section.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
For example, you could write up a Vagrant trigger that runs before
|
||||||
|
and after each provisioner:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
config.trigger.before :provisioner_run, type: :action do |t|
|
||||||
|
t.info = "Before the provision of the guest!!!"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
### Actions
|
### Actions
|
||||||
|
|
||||||
|
TODO: This still needs to be filled in.
|
||||||
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<strong>Advanced topic!</strong> This is an advanced topic for use only if
|
<strong>Advanced topic!</strong> This is an advanced topic for use only if
|
||||||
you want to execute triggers around Vagrant actions. If you are just getting
|
you want to execute triggers around Vagrant actions. If you are just getting
|
||||||
|
@ -158,13 +178,4 @@ command.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Actions in this case refer to the Vagrant class `#Action`, which is used internally
|
Actions in this case refer to the Vagrant class `#Action`, which is used internally
|
||||||
and in Vagrant plugins. These function similar to [action hooks](/docs/plugins/action-hooks.html)
|
to Vagrant and in every Vagrant plugin.
|
||||||
and give the user the ability to run triggers any where within the life cycle of
|
|
||||||
a Vagrant run. For example, you could write up a Vagrant trigger that runs before
|
|
||||||
and after the provision action:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
config.trigger.before :provisioner_run, type: :action do |t|
|
|
||||||
t.info = "Before the provision of the guest!!!"
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
Loading…
Reference in New Issue