Ensure that :all triggers don't get filtered out

This commit is contained in:
Brian Cain 2018-03-30 15:37:03 -07:00
parent 600557ff24
commit 85dedf25d9
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
2 changed files with 8 additions and 4 deletions

View File

@ -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,

View File

@ -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