diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index 2dafceaa7..8de536d67 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -2,7 +2,6 @@ require 'vagrant/action/builder' module Vagrant module Action - autoload :Environment, 'vagrant/action/environment' autoload :Runner, 'vagrant/action/runner' autoload :Warden, 'vagrant/action/warden' diff --git a/lib/vagrant/action/builtin/call.rb b/lib/vagrant/action/builtin/call.rb index e5edd3b6b..b12fd156d 100644 --- a/lib/vagrant/action/builtin/call.rb +++ b/lib/vagrant/action/builtin/call.rb @@ -50,8 +50,11 @@ module Vagrant @child_app = builder.to_app(new_env) final_env = runner.run(@child_app, new_env) + # Merge the environment into our original environment + env.merge!(final_env) + # Call the next step using our final environment - @app.call(final_env) + @app.call(env) end def recover(env) diff --git a/lib/vagrant/action/environment.rb b/lib/vagrant/action/environment.rb deleted file mode 100644 index 011601975..000000000 --- a/lib/vagrant/action/environment.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'vagrant/util/hash_with_indifferent_access' - -module Vagrant - module Action - # Represents an action environment which is what is passed - # to the `call` method of each action. This environment contains - # some helper methods for accessing the environment as well - # as being a hash, to store any additional options. - class Environment < Util::HashWithIndifferentAccess - end - end -end diff --git a/lib/vagrant/action/runner.rb b/lib/vagrant/action/runner.rb index 7309a4010..052043e9e 100644 --- a/lib/vagrant/action/runner.rb +++ b/lib/vagrant/action/runner.rb @@ -23,7 +23,7 @@ module Vagrant raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call) # Create the initial environment with the options given - environment = Environment.new + environment = {} environment.merge!(@globals) environment.merge!(@lazy_globals.call) if @lazy_globals environment.merge!(options || {}) diff --git a/test/unit/vagrant/action/builtin/call_test.rb b/test/unit/vagrant/action/builtin/call_test.rb index 95dbd5e37..bb3c9fc02 100644 --- a/test/unit/vagrant/action/builtin/call_test.rb +++ b/test/unit/vagrant/action/builtin/call_test.rb @@ -18,6 +18,17 @@ describe Vagrant::Action::Builtin::Call do received.should == "value" end + it "should update the original env with any changes" do + callable = lambda { |env| } + next_step = lambda { |env| env[:inner] = true } + + described_class.new(app, env, callable) do |_env, builder| + builder.use next_step + end.call(env) + + env[:inner].should == true + end + it "should call the callable with the original environment" do received = nil callable = lambda { |env| received = env[:foo] }