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 <teemu.matilainen@iki.fi>
This commit is contained in:
Jon Topper 2014-02-21 23:40:10 -03:00 committed by Teemu Matilainen
parent 7d90191212
commit 7b30e557cd
1 changed files with 1 additions and 1 deletions

View File

@ -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!('"', '\"')