Action runner supports global parameters
This commit is contained in:
parent
bbb8f0ac2c
commit
b31c3d458c
|
@ -11,8 +11,9 @@ module Vagrant
|
|||
class Runner
|
||||
@@reported_interrupt = false
|
||||
|
||||
def initialize(registry)
|
||||
def initialize(registry, globals=nil)
|
||||
@registry = registry
|
||||
@globals = globals || {}
|
||||
@logger = Log4r::Logger.new("vagrant::action::runner")
|
||||
end
|
||||
|
||||
|
@ -24,6 +25,7 @@ module Vagrant
|
|||
|
||||
# Create the initial environment with the options given
|
||||
environment = Environment.new
|
||||
environment.merge!(@globals)
|
||||
environment.merge!(options || {})
|
||||
|
||||
# Run the action chain in a busy block, marking the environment as
|
||||
|
|
|
@ -40,4 +40,15 @@ describe Vagrant::Action::Runner do
|
|||
instance.run(callable, "data" => "foo")
|
||||
result.should == "foo"
|
||||
end
|
||||
|
||||
it "should pass global options into the hash" do
|
||||
result = nil
|
||||
callable = lambda do |env|
|
||||
result = env["data"]
|
||||
end
|
||||
|
||||
instance = described_class.new(registry, "data" => "bar")
|
||||
instance.run(callable)
|
||||
result.should == "bar"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue