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