From 940693287d1d0a05073c6d3e584effe6d40d9193 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 22 Jul 2010 09:00:23 -0700 Subject: [PATCH] Export returns immediately if an error is there prior to the export [closes GH-117] --- lib/vagrant/action/vm/export.rb | 1 + test/vagrant/action/vm/export_test.rb | 11 +++++++++++ vagrant.gemspec | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/action/vm/export.rb b/lib/vagrant/action/vm/export.rb index 24485cbc3..15fc96f40 100644 --- a/lib/vagrant/action/vm/export.rb +++ b/lib/vagrant/action/vm/export.rb @@ -13,6 +13,7 @@ module Vagrant @env = env return env.error!(:vm_power_off_to_package) if !@env["vm"].vm.powered_off? + return if env.error? setup_temp_dir export diff --git a/test/vagrant/action/vm/export_test.rb b/test/vagrant/action/vm/export_test.rb index b9c90c4f4..a486e224c 100644 --- a/test/vagrant/action/vm/export_test.rb +++ b/test/vagrant/action/vm/export_test.rb @@ -40,6 +40,17 @@ class ExportVMActionTest < Test::Unit::TestCase assert @env.error? assert_equal :vm_power_off_to_package, @env.error.first end + + should "halt the chain if env error" do + @internal_vm.stubs(:powered_off?).returns(true) + @instance.expects(:setup_temp_dir).never + @instance.expects(:export).never + @app.expects(:call).with(@env).never + @instance.expects(:cleanup).never + + @env.error!(:interrupt) + @instance.call(@env) + end end context "cleaning up" do diff --git a/vagrant.gemspec b/vagrant.gemspec index 00bbe6619..edac0ccea 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["Mitchell Hashimoto", "John Bender"] - s.date = %q{2010-07-21} + s.date = %q{2010-07-22} s.default_executable = %q{vagrant} s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.} s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]