Ability to specify no parallelism on the environment

This commit is contained in:
Mitchell Hashimoto 2013-04-16 15:13:00 -07:00
parent 4bb5da7232
commit f3cf23e873
2 changed files with 13 additions and 2 deletions

View File

@ -197,9 +197,11 @@ module Vagrant
#
# This handles the case where batch actions are disabled by the
# VAGRANT_NO_PARALLEL environmental variable.
def batch
def batch(disable_parallel=false)
disable_parallel ||= !!ENV["VAGRANT_NO_PARALLEL"]
@batch_lock.synchronize do
BatchAction.new(!!ENV["VAGRANT_NO_PARALLEL"]).tap do |b|
BatchAction.new(disable_parallel).tap do |b|
# Yield it so that the caller can setup actions
yield b

View File

@ -64,6 +64,15 @@ describe Vagrant::Environment do
instance.batch {}
end
end
it "should run with disabling parallelization if explicit" do
with_temp_env("VAGRANT_NO_PARALLEL" => nil) do
Vagrant::BatchAction.should_receive(:new).with(true).and_return(batch)
batch.should_receive(:run)
instance.batch(true) {}
end
end
end
context "with the disabling env var" do