core: build action builder if responds to call

This commit is contained in:
Mitchell Hashimoto 2013-12-03 11:43:23 -08:00
parent ae472dece9
commit 1550946b0c
1 changed files with 10 additions and 2 deletions

View File

@ -19,8 +19,16 @@ module Vagrant
def run(callable_id, options=nil)
callable = callable_id
callable = Builder.build(callable_id) if callable_id.kind_of?(Class) || callable_id.is_a?(Method)
raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
if !callable.kind_of?(Builder)
if callable_id.kind_of?(Class) || callable_id.respond_to?(:call)
callable = Builder.build(callable_id)
end
end
if !callable || !callable.respond_to?(:call)
raise ArgumentError,
"Argument to run must be a callable object or registered action."
end
# Create the initial environment with the options given
environment = {}