The --provider flag for `up` now actually does something.

This commit is contained in:
Mitchell Hashimoto 2012-12-23 21:23:08 -08:00
parent 92436ee547
commit 8fe0f86dbd
3 changed files with 17 additions and 3 deletions

View File

@ -62,6 +62,9 @@ module Vagrant
#
# @param [String] name The name of the VM. Nil if every VM.
# @param [Hash] options Additional tweakable settings.
# @option options [Symbol] :provider The provider to back the
# machines with. All machines will be backed with this
# provider. If none is given, a sensible default is chosen.
# @option options [Boolean] :reverse If true, the resulting order
# of machines is reversed.
# @option options [Boolean] :single_target If true, then an
@ -78,7 +81,7 @@ module Vagrant
names = [names] if !names.is_a?(Array)
# The provider that we'll be loading up.
provider = @env.default_provider
provider = (options[:provider] || @env.default_provider).to_sym
# First determine the proper array of VMs.
machines = []

View File

@ -19,7 +19,7 @@ module VagrantPlugins
o.on("--provider provider", String,
"Back the machine with a specific provider.") do |provider|
options["provider"] = provider
options[:provider] = provider
end
end
@ -29,7 +29,7 @@ module VagrantPlugins
# Go over each VM and bring it up
@logger.debug("'Up' each target VM...")
with_target_vms(argv) do |machine|
with_target_vms(argv, :provider => options[:provider]) do |machine|
machine.action(:up)
end

View File

@ -107,6 +107,17 @@ describe Vagrant::Plugin::V2::Command do
instance.with_target_vms("foo") { |vm| vms << vm }
vms.should == [foo_vm]
end
it "yields the given VM with proper provider if given" do
foo_vm = double("foo")
provider = :foobarbaz
environment.stub(:machine).with(:foo, provider).and_return(foo_vm)
vms = []
instance.with_target_vms("foo", :provider => provider) { |vm| vms << vm }
vms.should == [foo_vm]
end
end
describe "splitting the main and subcommand args" do