diff --git a/lib/vagrant/plugin/v2/trigger.rb b/lib/vagrant/plugin/v2/trigger.rb index 32f782e55..c0b0bc478 100644 --- a/lib/vagrant/plugin/v2/trigger.rb +++ b/lib/vagrant/plugin/v2/trigger.rb @@ -35,9 +35,13 @@ module Vagrant # get all triggers matching action triggers = [] if stage == :before - triggers = config.before_triggers.select { |t| t.command == action } + triggers = config.before_triggers.select do |t| + t.command == action || (t.command == :all && !t.ignore.any?(action)) + end elsif stage == :after - triggers = config.after_triggers.select { |t| t.command == action } + triggers = config.after_triggers.select do |t| + t.command == action || (t.command == :all && !t.ignore.any?(action)) + end else raise Errors::TriggersNoStageGiven, action: action, diff --git a/plugins/kernel_v2/config/vm_trigger.rb b/plugins/kernel_v2/config/vm_trigger.rb index 30f53acfb..91783f150 100644 --- a/plugins/kernel_v2/config/vm_trigger.rb +++ b/plugins/kernel_v2/config/vm_trigger.rb @@ -92,7 +92,7 @@ module VagrantPlugins @info = nil if @info == UNSET_VALUE @warn = nil if @warn == UNSET_VALUE @on_error = DEFAULT_ON_ERROR if @on_error == UNSET_VALUE - @ignore = nil if @ignore == UNSET_VALUE + @ignore = [] if @ignore == UNSET_VALUE @run = nil if @run == UNSET_VALUE @run_remote = nil if @run_remote == UNSET_VALUE @only_on = nil if @only_on == UNSET_VALUE @@ -139,7 +139,7 @@ module VagrantPlugins commands.push(key) end - if !commands.include?(@command) + if !commands.include?(@command) && @command != :all machine.ui.warn(I18n.t("vagrant.config.triggers.bad_command_warning", cmd: @command)) end