From 8b40f2bb2d919543347b0c7e96249a417c9b96bd Mon Sep 17 00:00:00 2001 From: David Lundgren Date: Fri, 10 Oct 2014 11:02:01 -0500 Subject: [PATCH] Don't update the NFS exports file [GH-4148] Wrapped the NFS export modification process with a check for when there are not exports to be modified --- plugins/synced_folders/nfs/synced_folder.rb | 29 ++++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index f84c43b33..f2cdbd0dd 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -69,20 +69,23 @@ module VagrantPlugins 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] - @@lock.synchronize do - begin - 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, export_folders) + # Update the exports when there are actually exports [GH-4148] + if !export_folders.empty? + # 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] + @@lock.synchronize do + begin + 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, export_folders) + end + rescue Vagrant::Errors::EnvironmentLockedError + sleep 1 + retry end - rescue Vagrant::Errors::EnvironmentLockedError - sleep 1 - retry end end