Changed semantics of 'up.' 'up' will now only provision when the VM is being created from scratch. Otherwise, it simply starts the VM. [closes GH-78]
This commit is contained in:
parent
d76e9ba26a
commit
b949861186
|
@ -8,7 +8,7 @@ module Vagrant
|
||||||
steps = [Boot]
|
steps = [Boot]
|
||||||
if !@runner.vm || !@runner.vm.saved?
|
if !@runner.vm || !@runner.vm.saved?
|
||||||
steps.unshift([Customize, ForwardPorts, SharedFolders])
|
steps.unshift([Customize, ForwardPorts, SharedFolders])
|
||||||
steps << Provision if !@runner.env.config.vm.provisioner.nil?
|
steps << Provision if !@runner.env.config.vm.provisioner.nil? && !@runner.created?
|
||||||
end
|
end
|
||||||
|
|
||||||
steps.flatten.each do |action_klass|
|
steps.flatten.each do |action_klass|
|
||||||
|
|
|
@ -2,11 +2,12 @@ require File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper')
|
||||||
|
|
||||||
class StartActionTest < Test::Unit::TestCase
|
class StartActionTest < Test::Unit::TestCase
|
||||||
setup do
|
setup do
|
||||||
@mock_vm, @vm, @action = mock_action(Vagrant::Actions::VM::Start)
|
@runner, @vm, @action = mock_action(Vagrant::Actions::VM::Start)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "sub-actions" do
|
context "sub-actions" do
|
||||||
setup do
|
setup do
|
||||||
|
@runner.stubs(:created?).returns(false)
|
||||||
@vm.stubs(:saved?).returns(true)
|
@vm.stubs(:saved?).returns(true)
|
||||||
File.stubs(:file?).returns(true)
|
File.stubs(:file?).returns(true)
|
||||||
File.stubs(:exist?).returns(true)
|
File.stubs(:exist?).returns(true)
|
||||||
|
@ -16,7 +17,7 @@ class StartActionTest < Test::Unit::TestCase
|
||||||
def setup_action_expectations
|
def setup_action_expectations
|
||||||
default_seq = sequence("default_seq")
|
default_seq = sequence("default_seq")
|
||||||
@default_order.flatten.each do |action|
|
@default_order.flatten.each do |action|
|
||||||
@mock_vm.expects(:add_action).with(action).once.in_sequence(default_seq)
|
@runner.expects(:add_action).with(action).once.in_sequence(default_seq)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ class StartActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "add do additional if VM is not created yet" do
|
should "add do additional if VM is not created yet" do
|
||||||
@mock_vm.stubs(:vm).returns(nil)
|
@runner.stubs(:vm).returns(nil)
|
||||||
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
||||||
setup_action_expectations
|
setup_action_expectations
|
||||||
@action.prepare
|
@action.prepare
|
||||||
|
@ -42,11 +43,21 @@ class StartActionTest < Test::Unit::TestCase
|
||||||
should "add provisioning if its enabled and not saved" do
|
should "add provisioning if its enabled and not saved" do
|
||||||
@vm.env.config.vm.provisioner = :chef_solo
|
@vm.env.config.vm.provisioner = :chef_solo
|
||||||
|
|
||||||
@mock_vm.stubs(:vm).returns(nil)
|
@runner.stubs(:vm).returns(nil)
|
||||||
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
||||||
@default_order << Vagrant::Actions::VM::Provision
|
@default_order << Vagrant::Actions::VM::Provision
|
||||||
setup_action_expectations
|
setup_action_expectations
|
||||||
@action.prepare
|
@action.prepare
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "not add provisioning if enabled but already created" do
|
||||||
|
@runner.stubs(:created?).returns(true)
|
||||||
|
@vm.env.config.vm.provisioner = :chef_solo
|
||||||
|
|
||||||
|
@runner.stubs(:vm).returns(nil)
|
||||||
|
@default_order.unshift([Vagrant::Actions::VM::Customize, Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders])
|
||||||
|
setup_action_expectations
|
||||||
|
@action.prepare
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,8 @@ class UpActionTest < Test::Unit::TestCase
|
||||||
|
|
||||||
context "sub-actions" do
|
context "sub-actions" do
|
||||||
setup do
|
setup do
|
||||||
|
@runner.stubs(:created?).returns(false)
|
||||||
|
|
||||||
File.stubs(:file?).returns(true)
|
File.stubs(:file?).returns(true)
|
||||||
File.stubs(:exist?).returns(true)
|
File.stubs(:exist?).returns(true)
|
||||||
@default_order = [Vagrant::Actions::VM::Import, Vagrant::Actions::VM::Start]
|
@default_order = [Vagrant::Actions::VM::Import, Vagrant::Actions::VM::Start]
|
||||||
|
|
Loading…
Reference in New Issue