core: return nil if cached synced folders file doesn't exist

This commit is contained in:
Mitchell Hashimoto 2014-04-16 13:48:46 -07:00
parent 4557ece4df
commit cabacae4cb
2 changed files with 7 additions and 0 deletions

View File

@ -168,6 +168,8 @@ module Vagrant
r.delete(k) r.delete(k)
end end
end end
rescue Errno::ENOENT
return nil
end end
end end
end end

View File

@ -136,6 +136,11 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do
expect(result[:nfs]["root"][:foo]).to eql("bar") expect(result[:nfs]["root"][:foo]).to eql("bar")
end end
it "returns nil if cached read with no cache" do
result = subject.synced_folders(machine, nil, cached: true)
expect(result).to be_nil
end
it "should be able to save and retrieve cached versions" do it "should be able to save and retrieve cached versions" do
folders["root"] = {} folders["root"] = {}
folders["another"] = { type: "" } folders["another"] = { type: "" }