diff --git a/lib/vagrant/action/runner.rb b/lib/vagrant/action/runner.rb index cf7db63eb..ba3833897 100644 --- a/lib/vagrant/action/runner.rb +++ b/lib/vagrant/action/runner.rb @@ -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 diff --git a/test/unit/vagrant/action/runner_test.rb b/test/unit/vagrant/action/runner_test.rb index 15f10013e..2a3e1d4cd 100644 --- a/test/unit/vagrant/action/runner_test.rb +++ b/test/unit/vagrant/action/runner_test.rb @@ -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