Rescue the EHOSTDOWN error for SSH

This commit is contained in:
Mitchell Hashimoto 2013-01-12 12:47:49 -08:00
parent 0fd5152db4
commit 22571bf05b
3 changed files with 11 additions and 0 deletions

View File

@ -374,6 +374,10 @@ module Vagrant
error_key(:ssh_disconnected)
end
class SSHHostDown < VagrantError
error_key(:ssh_host_down)
end
class SSHKeyBadPermissions < VagrantError
status_code(12)
error_key(:ssh_key_bad_permissions)

View File

@ -184,6 +184,9 @@ module VagrantPlugins
rescue Errno::ECONNREFUSED
# This is raised if we failed to connect the max amount of times
raise Vagrant::Errors::SSHConnectionRefused
rescue Errno::EHOSTDOWN
# This is raised if we get an ICMP DestinationUnknown error.
raise Vagrant::Errors::SSHHostDown
rescue NotImplementedError
# This is raised if a private key type that Net-SSH doesn't support
# is used. Show a nicer error.

View File

@ -201,6 +201,10 @@ en:
usually indicates that SSH within the guest machine was unable to
properly start up. Please boot the VM in GUI mode to check whether
it is booting properly.
ssh_host_down: |-
While attempting to connect with SSH, a "host is down" (EHOSTDOWN)
error was received. Please verify your SSH settings are correct
and try again.
ssh_key_bad_permissions: |-
The private key to connect to this box via SSH has invalid permissions
set on it. The permissions of the private key should be set to 0600, otherwise SSH will