If no shared folders existed, don't worry about clearing them

This commit is contained in:
Mitchell Hashimoto 2010-06-03 20:35:12 -07:00
parent 97facb08fd
commit b13de6a497
2 changed files with 14 additions and 6 deletions

View File

@ -31,6 +31,7 @@ module Vagrant
end end
def clear_shared_folders def clear_shared_folders
if runner.vm.shared_folders.length > 0
logger.info "Clearing previously set shared folders..." logger.info "Clearing previously set shared folders..."
folders = @runner.vm.shared_folders.dup folders = @runner.vm.shared_folders.dup
@ -40,6 +41,7 @@ module Vagrant
@runner.reload! @runner.reload!
end end
end
def create_metadata def create_metadata
logger.info "Creating shared folders metadata..." logger.info "Creating shared folders metadata..."

View File

@ -81,6 +81,12 @@ class SharedFoldersActionTest < Test::Unit::TestCase
@runner.expects(:reload!).once.in_sequence(destroy_seq) @runner.expects(:reload!).once.in_sequence(destroy_seq)
@action.clear_shared_folders @action.clear_shared_folders
end end
should "do nothing if no shared folders existed" do
@shared_folders.clear
@runner.expects(:reload!).never
@action.clear_shared_folders
end
end end
context "setting up shared folder metadata" do context "setting up shared folder metadata" do