From 85dedf25d93e7dbdd75559c4d336f90a8186260c Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Fri, 30 Mar 2018 15:37:03 -0700 Subject: [PATCH] Ensure that :all triggers don't get filtered out --- lib/vagrant/plugin/v2/trigger.rb | 8 ++++++-- plugins/kernel_v2/config/vm_trigger.rb | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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