core: clean up default logic
This commit is contained in:
parent
59dbe51ef2
commit
b7478e09f3
|
@ -320,7 +320,7 @@ module Vagrant
|
|||
# Get the list of providers within our configuration and assign
|
||||
# a priority to each in the order they exist so that we try these first.
|
||||
config = {}
|
||||
root_config.vm.__providers.each_with_index do |key, idx|
|
||||
root_config.vm.__providers.reverse.each_with_index do |key, idx|
|
||||
config[key] = idx
|
||||
end
|
||||
|
||||
|
@ -340,8 +340,11 @@ module Vagrant
|
|||
# Skip excluded providers
|
||||
next if opts[:exclude] && opts[:exclude].include?(key)
|
||||
|
||||
# Skip providers that can't be defaulted
|
||||
next if popts.has_key?(:defaultable) && !popts[:defaultable]
|
||||
# Skip providers that can't be defaulted, unless they're in our
|
||||
# config, in which case someone made our decision for us.
|
||||
if !config.has_key?(key)
|
||||
next if popts.has_key?(:defaultable) && !popts[:defaultable]
|
||||
end
|
||||
|
||||
# The priority is higher if it is in our config. Otherwise, it is
|
||||
# the priority it set PLUS the length of the config to make sure it
|
||||
|
|
|
@ -810,6 +810,7 @@ VF
|
|||
|
||||
it "is the provider in the Vagrantfile that is usable" do
|
||||
subject.vagrantfile.config.vm.provider "foo"
|
||||
subject.vagrantfile.config.vm.provider "bar"
|
||||
subject.vagrantfile.config.vm.finalize!
|
||||
|
||||
plugin_providers[:foo] = [provider_usable_class(true), { priority: 5 }]
|
||||
|
|
Loading…
Reference in New Issue