commands/up: take into account forced provider
This commit is contained in:
parent
12b81600fb
commit
2d67b9ea3f
|
@ -82,7 +82,7 @@ module VagrantPlugins
|
||||||
# parallelize this step because it is likely the same provider
|
# parallelize this step because it is likely the same provider
|
||||||
# anyways.
|
# anyways.
|
||||||
if options[:install_provider]
|
if options[:install_provider]
|
||||||
install_providers(names)
|
install_providers(names, provider: options[:provider])
|
||||||
end
|
end
|
||||||
|
|
||||||
@env.batch(options[:parallel]) do |batch|
|
@env.batch(options[:parallel]) do |batch|
|
||||||
|
@ -124,7 +124,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def install_providers(names)
|
def install_providers(names, provider: nil)
|
||||||
# First create a set of all the providers we need to check for.
|
# First create a set of all the providers we need to check for.
|
||||||
# Most likely this will be a set of one.
|
# Most likely this will be a set of one.
|
||||||
providers = Set.new
|
providers = Set.new
|
||||||
|
@ -132,14 +132,24 @@ module VagrantPlugins
|
||||||
# Check if we have this machine in the index
|
# Check if we have this machine in the index
|
||||||
entry = @env.machine_index.get(name.to_s)
|
entry = @env.machine_index.get(name.to_s)
|
||||||
|
|
||||||
# Get the provider for this machine
|
# Get the provider for this machine. This logic isn't completely
|
||||||
provider = nil
|
# straightforward. If we have a forced provider, we always use
|
||||||
provider = entry.provider.to_sym if entry
|
# that no matter what. If we have an entry in the index (meaning
|
||||||
provider = @env.default_provider(
|
# the machine may be created), we use that provider no matter
|
||||||
machine: name.to_sym, check_usable: false) if !provider
|
# what since that will be used by the core. If we have none, then
|
||||||
|
# we ask the Vagrant env what the default provider would be and use
|
||||||
|
# that.
|
||||||
|
#
|
||||||
|
# Note that this logic is a bit redundant if we have "provider"
|
||||||
|
# set but I think its probably cleaner to put this logic in one
|
||||||
|
# place.
|
||||||
|
p = provider
|
||||||
|
p = entry.provider.to_sym if !p && entry
|
||||||
|
p = @env.default_provider(
|
||||||
|
machine: name.to_sym, check_usable: false) if !p
|
||||||
|
|
||||||
# Add it to the set
|
# Add it to the set
|
||||||
providers.add(provider)
|
providers.add(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Go through and determine if we can install the providers
|
# Go through and determine if we can install the providers
|
||||||
|
|
Loading…
Reference in New Issue