Environment#primary_machine takes a provider argument. Use it.
This commit is contained in:
parent
128c06e78d
commit
ac7958a43b
|
@ -230,14 +230,15 @@ module Vagrant
|
|||
# method is only applicable for multi-VM environments. This can
|
||||
# potentially be nil if no primary VM is specified.
|
||||
#
|
||||
# @param [Symbol] provider The provider to back the primary machine.
|
||||
# @return [VM]
|
||||
def primary_machine
|
||||
def primary_machine(provider)
|
||||
if machine_names.length == 1
|
||||
return machine(machine_names[0], :virtualbox)
|
||||
return machine(machine_names[0], provider)
|
||||
end
|
||||
|
||||
config_global.vm.defined_vms.each do |name, subvm|
|
||||
return machine(name, :virtualbox) if subvm.options[:primary]
|
||||
return machine(name, provider) if subvm.options[:primary]
|
||||
end
|
||||
|
||||
nil
|
||||
|
|
|
@ -110,7 +110,7 @@ module Vagrant
|
|||
|
||||
# Make sure we're only working with one VM if single target
|
||||
if options[:single_target] && machines.length != 1
|
||||
primary = @env.primary_machine
|
||||
primary = @env.primary_machine(provider)
|
||||
raise Errors::MultiVMTargetRequired if !primary
|
||||
machines = [primary]
|
||||
end
|
||||
|
|
|
@ -111,7 +111,7 @@ describe Vagrant::Environment do
|
|||
|
||||
describe "primary machine" do
|
||||
it "should be the only machine if not a multi-machine environment" do
|
||||
instance.primary_machine.name.should == instance.machine_names.first
|
||||
instance.primary_machine(:virtualbox).name.should == instance.machine_names.first
|
||||
end
|
||||
|
||||
it "should be the machine marked as the primary" do
|
||||
|
@ -128,7 +128,7 @@ VF
|
|||
end
|
||||
|
||||
env = environment.create_vagrant_env
|
||||
env.primary_machine.name.should == :bar
|
||||
env.primary_machine(:virtualbox).name.should == :bar
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue