Shared folders with no guest path are not automounted [closes GH-184]

This commit is contained in:
Mitchell Hashimoto 2010-12-31 02:19:18 -06:00
parent 4cbce66ab1
commit c1be64ae61
4 changed files with 19 additions and 5 deletions

View File

@ -3,6 +3,7 @@
- Use numeric uid/gid in mounting shared folders to increase portability. [GH-252]
- HTTP downloading follows redirects. [GH-163]
- Downloaders have clearer output to note what they're doing.
- Shared folders with no guest path are not automounted. [GH-184]
## 0.7.0.beta (December 24, 2010)

View File

@ -50,10 +50,17 @@ module Vagrant
@env["vm"].ssh.execute do |ssh|
shared_folders.each do |name, data|
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
:name => name,
:guest_path => data[:guestpath]))
@env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
if data[:guestpath]
# Guest path specified, so mount the folder to specified point
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
:name => name,
:guest_path => data[:guestpath]))
@env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
else
# If no guest path is specified, then automounting is disabled
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.nomount_entry",
:name => name))
end
end
end
end

View File

@ -361,6 +361,7 @@ en:
creating: Creating shared folders metadata...
mounting: Mounting shared folders...
mounting_entry: "-- %{name}: %{guest_path}"
nomount_entry: "-- %{name}: Automounting disabled."
suspend:
suspending: Saving VM state and suspending execution...

View File

@ -116,6 +116,7 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
@folders = stub_shared_folders(<<-sf)
config.vm.share_folder("foo", "fooguest", "foohost")
config.vm.share_folder("bar", "barguest", "barhost")
config.vm.share_folder("foo_no_mount", nil, "foohost2")
sf
@ssh = mock("ssh")
@vm.ssh.stubs(:execute).yields(@ssh)
@ -125,7 +126,11 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
should "mount all shared folders to the VM" do
mount_seq = sequence("mount_seq")
@folders.each do |name, data|
@vm.system.expects(:mount_shared_folder).with(@ssh, name, data[:guestpath]).in_sequence(mount_seq)
if data[:guestpath]
@vm.system.expects(:mount_shared_folder).with(@ssh, name, data[:guestpath]).in_sequence(mount_seq)
else
@vm.system.expects(:mount_shared_folder).with(@ssh, name, anything).never
end
end
@instance.mount_shared_folders