Modify start to only boot for saved VMs, no sharing folders, etc.

This commit is contained in:
Mitchell Hashimoto 2010-04-09 21:26:56 -07:00
parent fd3012ae00
commit 43f66c1693
4 changed files with 8 additions and 8 deletions

View File

@ -5,10 +5,10 @@ module Vagrant
def prepare def prepare
# Start is a "meta-action" so it really just queues up a bunch # Start is a "meta-action" so it really just queues up a bunch
# of other actions in its place: # of other actions in its place:
steps = [ForwardPorts, SharedFolders, Boot] steps = [Boot]
steps.unshift(Customize) unless @runner.vm.saved? steps.unshift([Customize, ForwardPorts, SharedFolders]) unless @runner.vm.saved?
steps.each do |action_klass| steps.flatten.each do |action_klass|
@runner.add_action(action_klass) @runner.add_action(action_klass)
end end
end end

View File

@ -92,7 +92,7 @@ class ForwardPortsActionTest < Test::Unit::TestCase
forwarded_ports = [] forwarded_ports = []
5.times do |i| 5.times do |i|
port = mock("port#{i}") port = mock("port#{i}")
port.expects(:destroy).with(true).once port.expects(:destroy).once
forwarded_ports << port forwarded_ports << port
end end

View File

@ -10,12 +10,12 @@ class StartActionTest < Test::Unit::TestCase
@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)
@default_order = [Vagrant::Actions::VM::ForwardPorts, Vagrant::Actions::VM::SharedFolders, Vagrant::Actions::VM::Boot] @default_order = [Vagrant::Actions::VM::Boot]
end end
def setup_action_expectations def setup_action_expectations
default_seq = sequence("default_seq") default_seq = sequence("default_seq")
@default_order.each do |action| @default_order.flatten.each do |action|
@mock_vm.expects(:add_action).with(action).once.in_sequence(default_seq) @mock_vm.expects(:add_action).with(action).once.in_sequence(default_seq)
end end
end end
@ -27,7 +27,7 @@ class StartActionTest < Test::Unit::TestCase
should "add customize to the beginning if its not saved" do should "add customize to the beginning if its not saved" do
@vm.expects(:saved?).returns(false) @vm.expects(:saved?).returns(false)
@default_order.unshift(Vagrant::Actions::VM::Customize) @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
end end

View File

@ -11,7 +11,7 @@ class SuspendActionTest < Test::Unit::TestCase
end end
should "save the state of the VM" do should "save the state of the VM" do
@vm.expects(:save_state).with(true).once @vm.expects(:save_state).once
@action.execute! @action.execute!
end end