Can now ctrl-C during SSH attempts [closes GH-115]
This commit is contained in:
parent
4e8b6f32b4
commit
d09ebe1021
|
@ -16,6 +16,7 @@ module Vagrant
|
||||||
# Start up the VM and wait for it to boot.
|
# Start up the VM and wait for it to boot.
|
||||||
boot
|
boot
|
||||||
return env.error!(:vm_failed_to_boot) if !wait_for_boot
|
return env.error!(:vm_failed_to_boot) if !wait_for_boot
|
||||||
|
return if env.error?
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
end
|
end
|
||||||
|
@ -36,6 +37,10 @@ module Vagrant
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Return true so that the vm_failed_to_boot error doesn't
|
||||||
|
# get shown
|
||||||
|
return true if @env.interrupted?
|
||||||
|
|
||||||
sleep sleeptime
|
sleep sleeptime
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,17 @@ class BootVMActionTest < Test::Unit::TestCase
|
||||||
@app.expects(:call).never
|
@app.expects(:call).never
|
||||||
@instance.call(@env)
|
@instance.call(@env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "not continue chain if error occured" do
|
||||||
|
boot_seq = sequence("boot_seq")
|
||||||
|
@instance.expects(:boot).in_sequence(boot_seq)
|
||||||
|
@instance.expects(:wait_for_boot).returns(true).in_sequence(boot_seq).with() do
|
||||||
|
@env.error!(:interrupt)
|
||||||
|
true
|
||||||
|
end
|
||||||
|
@app.expects(:call).never
|
||||||
|
@instance.call(@env)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "booting" do
|
context "booting" do
|
||||||
|
@ -58,6 +69,12 @@ class BootVMActionTest < Test::Unit::TestCase
|
||||||
assert @instance.wait_for_boot(0)
|
assert @instance.wait_for_boot(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "return right away if interrupted" do
|
||||||
|
@env.error!(:interrupt)
|
||||||
|
@vm.ssh.expects(:up?).times(1).returns(false)
|
||||||
|
assert @instance.wait_for_boot(0)
|
||||||
|
end
|
||||||
|
|
||||||
should "ping the max number of times then just return" do
|
should "ping the max number of times then just return" do
|
||||||
@vm.ssh.expects(:up?).times(@env.env.config.ssh.max_tries.to_i).returns(false)
|
@vm.ssh.expects(:up?).times(@env.env.config.ssh.max_tries.to_i).returns(false)
|
||||||
assert !@instance.wait_for_boot(0)
|
assert !@instance.wait_for_boot(0)
|
||||||
|
|
Loading…
Reference in New Issue