lib/vagrant/action/runner.rb in vagrant-unbundled-2.2.19.0 vs lib/vagrant/action/runner.rb in vagrant-unbundled-2.3.2.0
- old
+ new
@@ -7,16 +7,24 @@
module Vagrant
module Action
class Runner
@@reported_interrupt = false
+ # @param globals [Hash] variables for the env to be passed to the action
+ # @yieldreturn [Hash] lazy-loaded vars merged into the env before action run
def initialize(globals=nil, &block)
@globals = globals || {}
@lazy_globals = block
@logger = Log4r::Logger.new("vagrant::action::runner")
end
+ # @see PrimaryRunner
+ # @see Vagrant::Action::Builder#primary
+ def primary?
+ false
+ end
+
def run(callable_id, options=nil)
callable = callable_id
if !callable.kind_of?(Builder)
if callable_id.kind_of?(Class) || callable_id.respond_to?(:call)
callable = Builder.build(callable_id)
@@ -24,9 +32,13 @@
end
if !callable || !callable.respond_to?(:call)
raise ArgumentError,
"Argument to run must be a callable object or registered action."
+ end
+
+ if callable.is_a?(Builder)
+ callable.primary = self.primary?
end
# Create the initial environment with the options given
environment = {}
environment.merge!(@globals)