synced_folders/nfs: don't nfs_prune on hosts that don't support it

This commit is contained in:
Mitchell Hashimoto 2014-01-15 20:28:27 -08:00
parent f4f97740fb
commit 285bda7a68
2 changed files with 14 additions and 0 deletions

View File

@ -14,6 +14,11 @@ module VagrantPlugins
return @app.call(env)
end
if !env[:machine].env.host.capability?(:nfs_prune)
@logger.info("Host doesn't support pruning NFS. Skipping.")
return @app.call(env)
end
@logger.info("NFS pruning. Valid IDs: #{env[:nfs_valid_ids].inspect}")
env[:machine].env.host.capability(
:nfs_prune, env[:machine].ui, env[:nfs_valid_ids])

View File

@ -31,9 +31,18 @@ describe VagrantPlugins::SyncedFolderNFS::ActionCleanup do
subject.call(env)
end
it "does nothing if the host doesn't support pruning NFS" do
host.stub(:capability?).with(:nfs_prune).and_return(false)
host.should_receive(:capability).never
app.should_receive(:call).with(env)
subject.call(env)
end
it "prunes the NFS entries if valid IDs are given" do
env[:nfs_valid_ids] = [1,2,3]
host.stub(:capability?).with(:nfs_prune).and_return(true)
host.should_receive(:capability).with(:nfs_prune, machine.ui, [1,2,3]).ordered
app.should_receive(:call).with(env).ordered