diff --git a/lib/vagrant/action/vm/export.rb b/lib/vagrant/action/vm/export.rb index 15fc96f40..e4c7e0909 100644 --- a/lib/vagrant/action/vm/export.rb +++ b/lib/vagrant/action/vm/export.rb @@ -18,7 +18,7 @@ module Vagrant setup_temp_dir export - @app.call(env) + @app.call(env) if !env.error? cleanup end diff --git a/test/vagrant/action/vm/export_test.rb b/test/vagrant/action/vm/export_test.rb index a486e224c..9efebded9 100644 --- a/test/vagrant/action/vm/export_test.rb +++ b/test/vagrant/action/vm/export_test.rb @@ -51,6 +51,20 @@ class ExportVMActionTest < Test::Unit::TestCase @env.error!(:interrupt) @instance.call(@env) end + + should "halt the chain if env error when call is reached" do + @internal_vm.stubs(:powered_off?).returns(true) + @instance.expects(:setup_temp_dir).once + @instance.expects(:export).once.with() do + @env.error!(:interrupt) + true + end + + @app.expects(:call).with(@env).never + @instance.expects(:cleanup).once + + @instance.call(@env) + end end context "cleaning up" do