From 92940a7c5d957947c9772448e83d5c55c97d9b82 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 8 May 2014 17:10:38 -0700 Subject: [PATCH] synced_folders/nfs: allow disabling export [GH-3636] --- CHANGELOG.md | 2 ++ plugins/synced_folders/nfs/synced_folder.rb | 12 +++++++++++- website/docs/source/v2/synced-folders/nfs.html.md | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cde000bc..26a27df25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index bcb9c7fd8..f84c43b33 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -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 diff --git a/website/docs/source/v2/synced-folders/nfs.html.md b/website/docs/source/v2/synced-folders/nfs.html.md index f9057caa3..1e0959581 100644 --- a/website/docs/source/v2/synced-folders/nfs.html.md +++ b/website/docs/source/v2/synced-folders/nfs.html.md @@ -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.