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 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

View File

@ -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

View File

@ -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