core: if can't communicate, force halt right away

This commit is contained in:
Mitchell Hashimoto 2014-02-23 22:25:59 -08:00
parent 8bb0094113
commit 4c070a04d2
2 changed files with 16 additions and 11 deletions

View File

@ -44,13 +44,10 @@ module Vagrant
# Only attempt to perform graceful shutdown under certain cases
# checked above.
if graceful
env[:ui].info I18n.t("vagrant.actions.vm.halt.graceful")
env[:ui].output(I18n.t("vagrant.actions.vm.halt.graceful"))
begin
env[:machine].guest.capability(:halt)
rescue Errors::MachineGuestNotReady
@logger.info("Machine guest not ready while attempting to halt. Ignoring.")
end
@logger.debug("Waiting for target graceful halt state: #{@target_state}")
begin
@ -62,6 +59,9 @@ module Vagrant
rescue Timeout::Error
# Don't worry about it, we catch the case later.
end
rescue Errors::MachineGuestNotReady
env[:ui].detail(I18n.t("vagrant.actions.vm.halt.guest_not_ready"))
end
# The result of this matters on whether we reached our
# proper target state or not.

View File

@ -1312,6 +1312,11 @@ en:
Forcing shutdown of VM...
graceful: |-
Attempting graceful shutdown of VM...
guest_not_ready: |-
Guest communication could not be established! This is usually because
SSH is not running, the authentication information was changed,
or some other networking issue. Vagrant will force halt, if
capable.
hostname:
setting: "Setting hostname..."
import: