diff --git a/plugins/synced_folders/nfs/config.rb b/plugins/synced_folders/nfs/config.rb index 21ff5274d..88e4fa2e3 100644 --- a/plugins/synced_folders/nfs/config.rb +++ b/plugins/synced_folders/nfs/config.rb @@ -3,17 +3,20 @@ require "vagrant" module VagrantPlugins module SyncedFolderNFS class Config < Vagrant.plugin("2", :config) + attr_accessor :functional attr_accessor :map_uid attr_accessor :map_gid def initialize super - @map_uid = UNSET_VALUE - @map_gid = UNSET_VALUE + @functional = UNSET_VALUE + @map_uid = UNSET_VALUE + @map_gid = UNSET_VALUE end def finalize! + @functional = true if @functional == UNSET_VALUE @map_uid = :auto if @map_uid == UNSET_VALUE @map_gid = :auto if @map_gid == UNSET_VALUE end diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index 8c02528f5..fd10930e0 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -25,6 +25,12 @@ module VagrantPlugins end def usable?(machine, raise_error=false) + # If the machine explicitly said NFS is not supported, then + # it isn't supported. + if !machine.config.nfs.functional + return false + end + # We don't currently support NFS on Windows if Vagrant::Util::Platform.windows? return false diff --git a/test/unit/plugins/synced_folders/nfs/config_test.rb b/test/unit/plugins/synced_folders/nfs/config_test.rb index 5fcca1618..c513e2889 100644 --- a/test/unit/plugins/synced_folders/nfs/config_test.rb +++ b/test/unit/plugins/synced_folders/nfs/config_test.rb @@ -5,17 +5,13 @@ require Vagrant.source_root.join("plugins/synced_folders/nfs/config") describe VagrantPlugins::SyncedFolderNFS::Config do subject { described_class.new } - describe "#map_gid" do - it "defaults to :auto" do + context "defaults" do + before do subject.finalize! - expect(subject.map_gid).to eq(:auto) end - end - describe "#map_uid" do - it "defaults to nil" do - subject.finalize! - expect(subject.map_uid).to eq(:auto) - end + its(:functional) { should be_true } + its(:map_gid) { should eq(:auto) } + its(:map_uid) { should eq(:auto) } end end