core: fix failig test around choosing default provider
This commit is contained in:
parent
ad758bf69a
commit
4d85e0e145
|
@ -315,6 +315,14 @@ module Vagrant
|
||||||
config[key] = idx
|
config[key] = idx
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Determine the max priority so that we can add the config priority
|
||||||
|
# to that to make sure it is highest.
|
||||||
|
max_priority = 0
|
||||||
|
Vagrant.plugin("2").manager.providers.each do |key, data|
|
||||||
|
priority = data[1][:priority]
|
||||||
|
max_priority = priority if priority > max_priority
|
||||||
|
end
|
||||||
|
|
||||||
ordered = []
|
ordered = []
|
||||||
Vagrant.plugin("2").manager.providers.each do |key, data|
|
Vagrant.plugin("2").manager.providers.each do |key, data|
|
||||||
impl = data[0]
|
impl = data[0]
|
||||||
|
@ -329,12 +337,8 @@ module Vagrant
|
||||||
# The priority is higher if it is in our config. Otherwise, it is
|
# 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
|
# the priority it set PLUS the length of the config to make sure it
|
||||||
# is never higher than the configuration keys.
|
# is never higher than the configuration keys.
|
||||||
priority = config[key]
|
priority = popts[:priority]
|
||||||
priority ||= popts[:priority] + config.length
|
priority = config[key] + max_priority if config.has_key?(key)
|
||||||
|
|
||||||
# If we have config, we multiply by -1 so that the ordering is
|
|
||||||
# such that the smallest numbers win.
|
|
||||||
priority *= -1 if !config.empty?
|
|
||||||
|
|
||||||
ordered << [priority, key, impl, popts]
|
ordered << [priority, key, impl, popts]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue