From 7b30e557cd124616ae11fdbf805d4bed17e0b13a Mon Sep 17 00:00:00 2001 From: Jon Topper Date: Fri, 21 Feb 2014 23:40:10 -0300 Subject: [PATCH] hosts/bsd: sort NFS exports to avoid false validation errors [GH-2927] With a synced folder configuration like so: synced_folder ".", "/vagrant", :nfs => true synced_folder "#{ENV['HOME']}/mirror", "/mirror", :nfs => true synced_folder ENV['HOME'], "/home/#{ENV['USER']}", :nfs => true on OSX, vagrant writes two overlapping exports to /etc/exports which then fail the export check. Iterating through the list of folders lexically builds a correct, single exports entry. Signed-off-by: Teemu Matilainen --- plugins/hosts/bsd/cap/nfs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hosts/bsd/cap/nfs.rb b/plugins/hosts/bsd/cap/nfs.rb index bf9e9a341..7172e3400 100644 --- a/plugins/hosts/bsd/cap/nfs.rb +++ b/plugins/hosts/bsd/cap/nfs.rb @@ -25,7 +25,7 @@ module VagrantPlugins # We build up this mapping within the following hash. logger.debug("Compiling map of sub-directories for NFS exports...") dirmap = {} - folders.each do |_, opts| + folders.sort_by { |_, opts| opts[:hostpath] }.each do |_, opts| hostpath = opts[:hostpath].dup hostpath.gsub!('"', '\"')