Catch Net::SSH::Disconnect when connecting to SSH

This error was experienced by @pearkes. It is thrown when the remote end
unexpectedly closes the remote end. This is usually caused by SSH not
being able to properly setup the connection.
This commit is contained in:
Mitchell Hashimoto 2012-07-04 08:26:09 -10:00
parent 639a6a72ed
commit 61621369d2
3 changed files with 16 additions and 0 deletions

View File

@ -153,6 +153,12 @@ module Vagrant
# This happens if authentication failed. We wrap the error in our
# own exception.
raise Errors::SSHAuthenticationFailed
rescue Net::SSH::Disconnect
# This happens if the remote server unexpectedly closes the
# connection. This is usually raised when SSH is running on the
# other side but can't properly setup a connection. This is
# usually a server-side issue.
raise Errors::SSHDisconnected
rescue Errno::ECONNREFUSED
# This is raised if we failed to connect the max amount of times
raise Errors::SSHConnectionRefused

View File

@ -333,6 +333,11 @@ module Vagrant
error_key(:ssh_connection_timeout)
end
class SSHDisconnected < VagrantError
status_code(83)
error_key(:ssh_disconnected)
end
class SSHKeyBadPermissions < VagrantError
status_code(12)
error_key(:ssh_key_bad_permissions)

View File

@ -131,6 +131,11 @@ en:
means that the VM booted, but there are issues with the SSH configuration
or network connectivity issues. Please try to `vagrant reload` or
`vagrant up` again.
ssh_disconnected: |-
The SSH connection was unexpectedly closed by the remote end. This
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_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