synced_folders/nfs: allow disabling export [GH-3636]

This commit is contained in:
Mitchell Hashimoto 2014-05-08 17:10:38 -07:00
parent 434a13b4e4
commit 92940a7c5d
3 changed files with 16 additions and 1 deletions

View File

@ -8,6 +8,8 @@ IMPROVEMENTS:
RDP client. [GH-3686]
- providers/docker: `build_args` config to specify extra args for
`docker build`. [GH-3684]
- synced\_folders/nfs: Can tell Vagrant not to handle exporting
by setting `nfs_export: false` [GH-3636]
BUG FIXES:

View File

@ -60,6 +60,15 @@ module VagrantPlugins
# and such on the folder itself.
folders.each { |id, opts| prepare_folder(machine, opts) }
# Determine what folders we'll export
export_folders = folders.dup
export_folders.keys.each do |id|
opts = export_folders[id]
if opts.has_key?(:nfs_export) && !opts[:nfs_export]
export_folders.delete(id)
end
end
# Export the folders. We do this with a class-wide lock because
# NFS exporting often requires sudo privilege and we don't want
# overlapping input requests. [GH-2680]
@ -68,7 +77,8 @@ module VagrantPlugins
machine.env.lock("nfs-export") do
machine.ui.info I18n.t("vagrant.actions.vm.nfs.exporting")
machine.env.host.capability(
:nfs_export, machine.ui, machine.id, machine_ip, folders)
:nfs_export,
machine.ui, machine.id, machine_ip, export_folders)
end
rescue Vagrant::Errors::EnvironmentLockedError
sleep 1

View File

@ -55,6 +55,9 @@ unique to NFS. These are listed below. These options can be specified in
the final part of the `config.vm.synced_folder` definition, along with the
`type` option.
* `nfs_export` (boolean) - If this is false, then Vagrant won't modify
your `/etc/exports` automatically and assumes you've done so already.
* `nfs_udp` (boolean) - Whether or not to use UDP as the transport. UDP
is faster but has some limitations (see the NFS documentation for more
details). This defaults to true.