synced_folders/nfs: don't nfs_prune on hosts that don't support it
This commit is contained in:
parent
f4f97740fb
commit
285bda7a68
|
@ -14,6 +14,11 @@ module VagrantPlugins
|
||||||
return @app.call(env)
|
return @app.call(env)
|
||||||
end
|
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}")
|
@logger.info("NFS pruning. Valid IDs: #{env[:nfs_valid_ids].inspect}")
|
||||||
env[:machine].env.host.capability(
|
env[:machine].env.host.capability(
|
||||||
:nfs_prune, env[:machine].ui, env[:nfs_valid_ids])
|
:nfs_prune, env[:machine].ui, env[:nfs_valid_ids])
|
||||||
|
|
|
@ -31,9 +31,18 @@ describe VagrantPlugins::SyncedFolderNFS::ActionCleanup do
|
||||||
subject.call(env)
|
subject.call(env)
|
||||||
end
|
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
|
it "prunes the NFS entries if valid IDs are given" do
|
||||||
env[:nfs_valid_ids] = [1,2,3]
|
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
|
host.should_receive(:capability).with(:nfs_prune, machine.ui, [1,2,3]).ordered
|
||||||
app.should_receive(:call).with(env).ordered
|
app.should_receive(:call).with(env).ordered
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue