`up --no-provision` works again. This disables provisioning during the process.

This commit is contained in:
Mitchell Hashimoto 2010-10-03 18:34:33 -07:00
parent d4af1d424b
commit eaaf55ea8a
6 changed files with 34 additions and 8 deletions

View File

@ -1,5 +1,7 @@
## 0.6.4 (unreleased)
- `up --no-provision` works again. This disables provisioning during the
boot process.
- Action warden doesn't do recovery process on `SystemExit` exceptions,
allowing the double ctrl-C to work properly again. [related to GH-166]
- Initial Vagrantfile is now heavily commented with various available

View File

@ -5,6 +5,7 @@ module Vagrant
def initialize(app, env)
@app = app
@env = env
@env["provision.enabled"] = true if !@env.has_key?("provision.enabled")
load_provisioner if provisioning_enabled?
end
@ -19,7 +20,7 @@ module Vagrant
end
def provisioning_enabled?
!@env["config"].vm.provisioner.nil?
!@env["config"].vm.provisioner.nil? && @env["provision.enabled"]
end
def load_provisioner

View File

@ -5,13 +5,12 @@ module Vagrant
register "up", "Creates the Vagrant environment"
def execute
# TODO: Make the options[:provision] actually mean something
target_vms.each do |vm|
if vm.created?
vm.env.ui.info I18n.t("vagrant.commands.up.vm_created")
vm.start
vm.start("provision.enabled" => options[:provision])
else
vm.up
vm.up("provision.enabled" => options[:provision])
end
end
end

View File

@ -115,11 +115,11 @@ module Vagrant
env.actions.run(:up, options)
end
def start
def start(options=nil)
return if @vm.running?
return resume if @vm.saved?
env.actions.run(:start)
env.actions.run(:start, options)
end
def halt(options=nil)

View File

@ -31,6 +31,12 @@ class ProvisionVMActionTest < Test::Unit::TestCase
@klass.any_instance.expects(:load_provisioner).never
@klass.new(@app, @env)
end
should "not load provisioner if disabled through env hash" do
@env["provision.enabled"] = false
@klass.any_instance.expects(:load_provisioner).never
@klass.new(@app, @env)
end
end
context "with an instance" do
@ -122,6 +128,14 @@ class ProvisionVMActionTest < Test::Unit::TestCase
@instance.call(@env)
end
should "continue chain and not provision if not enabled through env hash" do
@env["provision.enabled"] = false
@prov.expects(:provision!).never
@app.expects(:call).with(@env).once
@instance.call(@env)
end
end
end
end

View File

@ -177,6 +177,11 @@ class VMTest < Test::Unit::TestCase
@vm.env.actions.expects(:run).with(:up, nil).once
@vm.up
end
should "forward options to the action sequence" do
@vm.env.actions.expects(:run).with(:up, :foo => :bar).once
@vm.up(:foo => :bar)
end
end
context "halting" do
@ -236,14 +241,19 @@ class VMTest < Test::Unit::TestCase
should "execute the resume action if saved" do
@mock_vm.expects(:saved?).returns(true)
@vm.expects(:resume).once
@vm.env.actions.expects(:run).with(:start).never
@vm.env.actions.expects(:run).with(:start, nil).never
@vm.start
end
should "execute the start action" do
@vm.env.actions.expects(:run).with(:start).once
@vm.env.actions.expects(:run).with(:start, nil).once
@vm.start
end
should "forward options to the action sequence" do
@vm.env.actions.expects(:run).with(:start, :foo => :bar).once
@vm.start(:foo => :bar)
end
end
end
end