Merge pull request #11988 from soapy1/override-nfs

Replace :nfs option with :type for synced folders
This commit is contained in:
Sophia Castellarin 2020-10-28 14:06:22 -05:00 committed by GitHub
commit 3bac41a433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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!