Fully replace :nfs option with :type => :nfs for synced folders

This commit is contained in:
sophia 2020-10-22 14:59:34 -05:00
parent 74570802f3
commit e02bf717b9
2 changed files with 18 additions and 4 deletions

View File

@ -277,6 +277,11 @@ module VagrantPlugins
options ||= {}
if options[:nfs]
options[:type] = :nfs
options.delete(:nfs)
end
if options.has_key?(:name)
synced_folder_name = options.delete(:name)
else
@ -654,10 +659,6 @@ module VagrantPlugins
current_dir_shared = false
@__synced_folders.each do |id, options|
if options[:nfs]
options[:type] = :nfs
end
if options[:hostpath] == '.'
current_dir_shared = true
end

View File

@ -710,6 +710,19 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
expect(sf["/vagrant"][:foo]).to eq(:bar)
end
# This is a little bit of a special case since nfs can be specified
# as `type: "nfs"` or `nfs: true`
it "properly overrides nfs" do
subject.synced_folder(".", "/vagrant", nfs: true)
subject.synced_folder(".", "/vagrant", type: "rsync")
subject.finalize!
sf = subject.synced_folders
expect(sf.length).to eq(1)
expect(sf).to have_key("/vagrant")
expect(sf["/vagrant"][:type]).to be(:rsync)
expect(sf["/vagrant"][:nfs]).to eq(nil)
end
it "is not an error if guest path is empty but name is not" do
subject.synced_folder(".", "", name: "my-vagrant-folder")
subject.finalize!