`up --no-provision` works again. This disables provisioning during the process.
This commit is contained in:
parent
d4af1d424b
commit
eaaf55ea8a
|
@ -1,5 +1,7 @@
|
||||||
## 0.6.4 (unreleased)
|
## 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,
|
- Action warden doesn't do recovery process on `SystemExit` exceptions,
|
||||||
allowing the double ctrl-C to work properly again. [related to GH-166]
|
allowing the double ctrl-C to work properly again. [related to GH-166]
|
||||||
- Initial Vagrantfile is now heavily commented with various available
|
- Initial Vagrantfile is now heavily commented with various available
|
||||||
|
|
|
@ -5,6 +5,7 @@ module Vagrant
|
||||||
def initialize(app, env)
|
def initialize(app, env)
|
||||||
@app = app
|
@app = app
|
||||||
@env = env
|
@env = env
|
||||||
|
@env["provision.enabled"] = true if !@env.has_key?("provision.enabled")
|
||||||
|
|
||||||
load_provisioner if provisioning_enabled?
|
load_provisioner if provisioning_enabled?
|
||||||
end
|
end
|
||||||
|
@ -19,7 +20,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def provisioning_enabled?
|
def provisioning_enabled?
|
||||||
!@env["config"].vm.provisioner.nil?
|
!@env["config"].vm.provisioner.nil? && @env["provision.enabled"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_provisioner
|
def load_provisioner
|
||||||
|
|
|
@ -5,13 +5,12 @@ module Vagrant
|
||||||
register "up", "Creates the Vagrant environment"
|
register "up", "Creates the Vagrant environment"
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
# TODO: Make the options[:provision] actually mean something
|
|
||||||
target_vms.each do |vm|
|
target_vms.each do |vm|
|
||||||
if vm.created?
|
if vm.created?
|
||||||
vm.env.ui.info I18n.t("vagrant.commands.up.vm_created")
|
vm.env.ui.info I18n.t("vagrant.commands.up.vm_created")
|
||||||
vm.start
|
vm.start("provision.enabled" => options[:provision])
|
||||||
else
|
else
|
||||||
vm.up
|
vm.up("provision.enabled" => options[:provision])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,11 +115,11 @@ module Vagrant
|
||||||
env.actions.run(:up, options)
|
env.actions.run(:up, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start
|
def start(options=nil)
|
||||||
return if @vm.running?
|
return if @vm.running?
|
||||||
return resume if @vm.saved?
|
return resume if @vm.saved?
|
||||||
|
|
||||||
env.actions.run(:start)
|
env.actions.run(:start, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def halt(options=nil)
|
def halt(options=nil)
|
||||||
|
|
|
@ -31,6 +31,12 @@ class ProvisionVMActionTest < Test::Unit::TestCase
|
||||||
@klass.any_instance.expects(:load_provisioner).never
|
@klass.any_instance.expects(:load_provisioner).never
|
||||||
@klass.new(@app, @env)
|
@klass.new(@app, @env)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context "with an instance" do
|
context "with an instance" do
|
||||||
|
@ -122,6 +128,14 @@ class ProvisionVMActionTest < Test::Unit::TestCase
|
||||||
|
|
||||||
@instance.call(@env)
|
@instance.call(@env)
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -177,6 +177,11 @@ class VMTest < Test::Unit::TestCase
|
||||||
@vm.env.actions.expects(:run).with(:up, nil).once
|
@vm.env.actions.expects(:run).with(:up, nil).once
|
||||||
@vm.up
|
@vm.up
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context "halting" do
|
context "halting" do
|
||||||
|
@ -236,14 +241,19 @@ class VMTest < Test::Unit::TestCase
|
||||||
should "execute the resume action if saved" do
|
should "execute the resume action if saved" do
|
||||||
@mock_vm.expects(:saved?).returns(true)
|
@mock_vm.expects(:saved?).returns(true)
|
||||||
@vm.expects(:resume).once
|
@vm.expects(:resume).once
|
||||||
@vm.env.actions.expects(:run).with(:start).never
|
@vm.env.actions.expects(:run).with(:start, nil).never
|
||||||
@vm.start
|
@vm.start
|
||||||
end
|
end
|
||||||
|
|
||||||
should "execute the start action" do
|
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
|
@vm.start
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue