Only automount NFS folders which have guest path specified

This commit is contained in:
Mitchell Hashimoto 2010-12-31 02:24:49 -06:00
parent c1be64ae61
commit e12d96d4df
2 changed files with 10 additions and 2 deletions

View File

@ -113,7 +113,9 @@ module Vagrant
def mount_folders
@env.ui.info I18n.t("vagrant.actions.vm.nfs.mounting")
@env["vm"].system.mount_nfs(host_ip, folders)
# Only mount the folders which have a guest path specified
am_folders = folders.select { |folder| folder[:guestpath] }
@env["vm"].system.mount_nfs(host_ip, am_folders)
end
# Returns the IP address of the first host only network adapter

View File

@ -160,13 +160,19 @@ class NFSVMActionTest < Test::Unit::TestCase
context "mounting folders" do
setup do
@instance.stubs(:host_ip).returns("foo")
@instance.stubs(:folders).returns(["bar"])
@instance.stubs(:folders).returns([{:guestpath => "foo"}])
end
should "mount the folders on the system" do
@vm.system.expects(:mount_nfs).with(@instance.host_ip, @instance.folders)
@instance.mount_folders
end
should "not mount folders which have no guest path" do
@instance.stubs(:folders).returns([{}])
@vm.system.expects(:mount_nfs).with(@instance.host_ip, [])
@instance.mount_folders
end
end
context "getting the host IP" do