A much cleaner way to find NFS folders to mount

This commit is contained in:
Mitchell Hashimoto 2012-01-12 18:56:08 -08:00
parent de450f7e63
commit 5c2bb9412d
1 changed files with 8 additions and 4 deletions

View File

@ -110,7 +110,6 @@ module Vagrant
# up to the host class to define the specific behavior. # up to the host class to define the specific behavior.
def export_folders def export_folders
@env[:ui].info I18n.t("vagrant.actions.vm.nfs.exporting") @env[:ui].info I18n.t("vagrant.actions.vm.nfs.exporting")
@env[:host].nfs_export(@env[:vm].uuid, guest_ip, folders) @env[:host].nfs_export(@env[:vm].uuid, guest_ip, folders)
end end
@ -119,9 +118,14 @@ module Vagrant
@env[:ui].info I18n.t("vagrant.actions.vm.nfs.mounting") @env[:ui].info I18n.t("vagrant.actions.vm.nfs.mounting")
# Only mount the folders which have a guest path specified # Only mount the folders which have a guest path specified
am_folders = folders.select { |name, folder| folder[:guestpath] } mount_folders = {}
am_folders = Hash[*am_folders.flatten] if am_folders.is_a?(Array) folders.each do |name, opts|
@env[:vm].guest.mount_nfs(host_ip, Hash[am_folders]) if opts[:guestpath]
mount_folders[name] = opts.dup
end
end
@env[:vm].guest.mount_nfs(host_ip, mount_folders)
end end
# Returns the IP address of the first host only network adapter # Returns the IP address of the first host only network adapter