From ae750288ed3c7abbe5b9e8725284fb8dca964d99 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 5 Jul 2010 02:33:44 +0200 Subject: [PATCH] Only mount and do unison setup in the absense of error environments --- lib/vagrant/action/vm/share_folders.rb | 8 ++++++-- test/vagrant/action/vm/share_folders_test.rb | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/action/vm/share_folders.rb b/lib/vagrant/action/vm/share_folders.rb index 905402f58..5cc395f6c 100644 --- a/lib/vagrant/action/vm/share_folders.rb +++ b/lib/vagrant/action/vm/share_folders.rb @@ -15,8 +15,12 @@ module Vagrant @app.call(env) - mount_shared_folders - setup_unison + if !env.error? + # Only mount and setup shared folders in the absense of an + # error + mount_shared_folders + setup_unison + end end # This method returns an actual list of VirtualBox shared diff --git a/test/vagrant/action/vm/share_folders_test.rb b/test/vagrant/action/vm/share_folders_test.rb index f5ba746bc..c0ce8a7ec 100644 --- a/test/vagrant/action/vm/share_folders_test.rb +++ b/test/vagrant/action/vm/share_folders_test.rb @@ -46,6 +46,19 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase @instance.call(@env) end + + should "run only the metadata actions if erroneous environment" do + @env.error!(:foo) + + before_seq = sequence("before") + @instance.expects(:clear_shared_folders).once.in_sequence(before_seq) + @instance.expects(:create_metadata).once.in_sequence(before_seq) + @app.expects(:call).with(@env).in_sequence(before_seq) + @instance.expects(:mount_shared_folders).never + @instance.expects(:setup_unison).never + + @instance.call(@env) + end end context "collecting shared folders" do