Merge pull request #7756 from alexoj/master
Fix Vagrant not prioritizing configured providers correctly
This commit is contained in:
commit
28f2ed56cf
|
@ -338,7 +338,7 @@ module Vagrant
|
|||
# a priority to each in the order they exist so that we try these first.
|
||||
config = {}
|
||||
root_config.vm.__providers.reverse.each_with_index do |key, idx|
|
||||
config[key] = idx
|
||||
config[key] = idx + 1
|
||||
end
|
||||
|
||||
# Determine the max priority so that we can add the config priority
|
||||
|
|
|
@ -866,6 +866,30 @@ VF
|
|||
end
|
||||
end
|
||||
|
||||
it "is the provider in the Vagrantfile that is usable even if only one specified (1)" do
|
||||
subject.vagrantfile.config.vm.provider "foo"
|
||||
subject.vagrantfile.config.vm.finalize!
|
||||
|
||||
plugin_providers[:foo] = [provider_usable_class(true), { priority: 5 }]
|
||||
plugin_providers[:bar] = [provider_usable_class(true), { priority: 7 }]
|
||||
|
||||
with_temp_env("VAGRANT_DEFAULT_PROVIDER" => nil) do
|
||||
expect(subject.default_provider).to eq(:foo)
|
||||
end
|
||||
end
|
||||
|
||||
it "is the provider in the Vagrantfile that is usable even if only one specified (2)" do
|
||||
subject.vagrantfile.config.vm.provider "bar"
|
||||
subject.vagrantfile.config.vm.finalize!
|
||||
|
||||
plugin_providers[:foo] = [provider_usable_class(true), { priority: 7 }]
|
||||
plugin_providers[:bar] = [provider_usable_class(true), { priority: 5 }]
|
||||
|
||||
with_temp_env("VAGRANT_DEFAULT_PROVIDER" => nil) do
|
||||
expect(subject.default_provider).to eq(:bar)
|
||||
end
|
||||
end
|
||||
|
||||
it "is the highest usable provider outside the Vagrantfile" do
|
||||
subject.vagrantfile.config.vm.provider "foo"
|
||||
subject.vagrantfile.config.vm.finalize!
|
||||
|
|
Loading…
Reference in New Issue