Simplify trigger selection

This commit is contained in:
Brian Cain 2018-03-28 16:22:50 -07:00
parent 0e5cd900f8
commit 76418b9fcd
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
1 changed files with 3 additions and 7 deletions

View File

@ -30,9 +30,7 @@ module Vagrant
# @param [String] guest_name The guest that invoked firing the triggers # @param [String] guest_name The guest that invoked firing the triggers
def fire_before_triggers(action, guest_name) def fire_before_triggers(action, guest_name)
# get all triggers matching action # get all triggers matching action
triggers = config.before_triggers.select do |trigger| triggers = config.before_triggers.select { |t| t.command == action }
trigger.command == action
end
triggers = filter_triggers(triggers, guest_name) triggers = filter_triggers(triggers, guest_name)
binding.pry binding.pry
@ -49,10 +47,8 @@ module Vagrant
# @param [Symbol] action Vagrant command to fire trigger on # @param [Symbol] action Vagrant command to fire trigger on
# @param [String] guest_name The guest that invoked firing the triggers # @param [String] guest_name The guest that invoked firing the triggers
def fire_after_triggers(action, guest_name) def fire_after_triggers(action, guest_name)
triggers = [] # get all triggers matching action
triggers = config.after_triggers.select do |trigger| triggers = config.after_triggers.select { |t| t.command == action }
trigger.command == action
end
triggers = filter_triggers(triggers, guest_name) triggers = filter_triggers(triggers, guest_name)
binding.pry binding.pry