Ensure action param is a symbol, and if nil return to do nothing

This commit is contained in:
Brian Cain 2019-01-30 16:59:20 -08:00
parent 6ac23f1a15
commit 08214ec90f
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 8 additions and 2 deletions

View File

@ -100,14 +100,13 @@ module Vagrant
# a `nil` args will actually pass `nil` into the class.
args ||= []
if klass.is_a?(Class)
# A action klass which is to be instantiated with the
# app, env, and any arguments given
# We wrap the action class in two Trigger method calls so that
# action triggers can fire before and after each given action in the stack.
klass_name = klass.name.to_sym
klass_name = klass.name
[Vagrant::Action::Builtin::BeforeTriggerAction.new(self, env,
klass_name,
@triggers),

View File

@ -42,6 +42,13 @@ module Vagrant
return
end
if !action
@logger.warn("Action given is nil, no triggers will fire")
return
else
action = action.to_sym
end
# get all triggers matching action
triggers = []
if stage == :before