kernel/v2: multiple synced folder lines override each other

This commit is contained in:
Mitchell Hashimoto 2014-05-08 18:39:13 -07:00
parent 92940a7c5d
commit a9029842a6
2 changed files with 14 additions and 1 deletions

View File

@ -184,9 +184,11 @@ module VagrantPlugins
end end
options ||= {} options ||= {}
options = options.dup
options[:guestpath] = guestpath.to_s.gsub(/\/$/, '') options[:guestpath] = guestpath.to_s.gsub(/\/$/, '')
options[:hostpath] = hostpath options[:hostpath] = hostpath
options = (@__synced_folders[options[:guestpath]] || {}).
merge(options.dup)
# Make sure the type is a symbol # Make sure the type is a symbol
options[:type] = options[:type].to_sym if options[:type] options[:type] = options[:type].to_sym if options[:type]

View File

@ -410,6 +410,17 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
expect(sf).to have_key("/vagrant") expect(sf).to have_key("/vagrant")
expect(sf["/vagrant"][:disabled]).to be_true expect(sf["/vagrant"][:disabled]).to be_true
end end
it "allows overriding previously set options" do
subject.synced_folder(".", "/vagrant", disabled: true)
subject.synced_folder(".", "/vagrant", foo: :bar)
subject.finalize!
sf = subject.synced_folders
expect(sf.length).to eq(1)
expect(sf).to have_key("/vagrant")
expect(sf["/vagrant"][:disabled]).to be_true
expect(sf["/vagrant"][:foo]).to eq(:bar)
end
end end
describe "#usable_port_range" do describe "#usable_port_range" do