Merge pull request #11939 from soapy1/disk-provider-config

Ensure provider specific config gets transformed into common form
This commit is contained in:
Sophia Castellarin 2020-10-13 14:03:34 -05:00 committed by GitHub
commit 5299eece36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -101,7 +101,7 @@ module VagrantPlugins
current = @provider_config.merge(current) if !@provider_config.empty?
if current
@provider_config = current[:provider_config]
@provider_config = current
else
@provider_config = {}
end

View File

@ -115,4 +115,12 @@ describe VagrantPlugins::Kernel_V2::VagrantConfigDisk do
assert_invalid
end
end
describe "#add_provider_config" do
it "normalizes provider config" do
test_provider_config = {provider__something: "special" }
subject.add_provider_config(test_provider_config)
expect(subject.provider_config).to eq( { provider: {something: "special" }} )
end
end
end

View File

@ -669,6 +669,16 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
expect(merged_disks[0].name).to eq("foo")
expect(merged_disks[1].name).to eq("bar")
end
it "adds provider config with `__` config form" do
subject.disk(:disk, size: 1000, primary: false, name: "storage", provider__something: "special")
expect(subject.disks[0].provider_config).to eq({:provider=>{:something=>"special"}})
end
it "adds provider config with Hash config form" do
subject.disk(:disk, size: 1000, primary: false, name: "storage", provider: {something: "special"})
expect(subject.disks[0].provider_config).to eq({:provider=>{:something=>"special"}})
end
end
describe "#synced_folder(s)" do