synced_folders/nfs: can say functional is false explicitly

This commit is contained in:
Mitchell Hashimoto 2014-04-21 20:37:14 -07:00
parent 8747d938aa
commit afd3f1ff43
3 changed files with 16 additions and 11 deletions

View File

@ -3,17 +3,20 @@ require "vagrant"
module VagrantPlugins module VagrantPlugins
module SyncedFolderNFS module SyncedFolderNFS
class Config < Vagrant.plugin("2", :config) class Config < Vagrant.plugin("2", :config)
attr_accessor :functional
attr_accessor :map_uid attr_accessor :map_uid
attr_accessor :map_gid attr_accessor :map_gid
def initialize def initialize
super super
@map_uid = UNSET_VALUE @functional = UNSET_VALUE
@map_gid = UNSET_VALUE @map_uid = UNSET_VALUE
@map_gid = UNSET_VALUE
end end
def finalize! def finalize!
@functional = true if @functional == UNSET_VALUE
@map_uid = :auto if @map_uid == UNSET_VALUE @map_uid = :auto if @map_uid == UNSET_VALUE
@map_gid = :auto if @map_gid == UNSET_VALUE @map_gid = :auto if @map_gid == UNSET_VALUE
end end

View File

@ -25,6 +25,12 @@ module VagrantPlugins
end end
def usable?(machine, raise_error=false) 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 # We don't currently support NFS on Windows
if Vagrant::Util::Platform.windows? if Vagrant::Util::Platform.windows?
return false return false

View File

@ -5,17 +5,13 @@ require Vagrant.source_root.join("plugins/synced_folders/nfs/config")
describe VagrantPlugins::SyncedFolderNFS::Config do describe VagrantPlugins::SyncedFolderNFS::Config do
subject { described_class.new } subject { described_class.new }
describe "#map_gid" do context "defaults" do
it "defaults to :auto" do before do
subject.finalize! subject.finalize!
expect(subject.map_gid).to eq(:auto)
end end
end
describe "#map_uid" do its(:functional) { should be_true }
it "defaults to nil" do its(:map_gid) { should eq(:auto) }
subject.finalize! its(:map_uid) { should eq(:auto) }
expect(subject.map_uid).to eq(:auto)
end
end end
end end