From 43f66c1693d1b0785bb12f5d7f12b0a59643618c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 9 Apr 2010 21:26:56 -0700 Subject: [PATCH] Modify start to only boot for saved VMs, no sharing folders, etc. --- lib/vagrant/actions/vm/start.rb | 6 +++--- test/vagrant/actions/vm/forward_ports_test.rb | 2 +- test/vagrant/actions/vm/start_test.rb | 6 +++--- test/vagrant/actions/vm/suspend_test.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/vagrant/actions/vm/start.rb b/lib/vagrant/actions/vm/start.rb index ba4e6856a..68c6474a4 100644 --- a/lib/vagrant/actions/vm/start.rb +++ b/lib/vagrant/actions/vm/start.rb @@ -5,10 +5,10 @@ module Vagrant def prepare # Start is a "meta-action" so it really just queues up a bunch # of other actions in its place: - steps = [ForwardPorts, SharedFolders, Boot] - steps.unshift(Customize) unless @runner.vm.saved? + steps = [Boot] + 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) end end diff --git a/test/vagrant/actions/vm/forward_ports_test.rb b/test/vagrant/actions/vm/forward_ports_test.rb index 18c1ef578..878c209e8 100644 --- a/test/vagrant/actions/vm/forward_ports_test.rb +++ b/test/vagrant/actions/vm/forward_ports_test.rb @@ -92,7 +92,7 @@ class ForwardPortsActionTest < Test::Unit::TestCase forwarded_ports = [] 5.times do |i| port = mock("port#{i}") - port.expects(:destroy).with(true).once + port.expects(:destroy).once forwarded_ports << port end diff --git a/test/vagrant/actions/vm/start_test.rb b/test/vagrant/actions/vm/start_test.rb index a42e51bf8..a64474e09 100644 --- a/test/vagrant/actions/vm/start_test.rb +++ b/test/vagrant/actions/vm/start_test.rb @@ -10,12 +10,12 @@ class StartActionTest < Test::Unit::TestCase @vm.stubs(:saved?).returns(true) File.stubs(:file?).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 def setup_action_expectations 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) end end @@ -27,7 +27,7 @@ class StartActionTest < Test::Unit::TestCase should "add customize to the beginning if its not saved" do @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 @action.prepare end diff --git a/test/vagrant/actions/vm/suspend_test.rb b/test/vagrant/actions/vm/suspend_test.rb index c5c769189..e51a25094 100644 --- a/test/vagrant/actions/vm/suspend_test.rb +++ b/test/vagrant/actions/vm/suspend_test.rb @@ -11,7 +11,7 @@ class SuspendActionTest < Test::Unit::TestCase end should "save the state of the VM" do - @vm.expects(:save_state).with(true).once + @vm.expects(:save_state).once @action.execute! end