Raise proper exception if SSH connection is refused with message to help people.
This commit is contained in:
parent
036edfcc2a
commit
759bbd046b
|
@ -199,6 +199,11 @@ module Vagrant
|
||||||
error_key(:ssh_authentication_failed)
|
error_key(:ssh_authentication_failed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class SSHConnectionRefused < VagrantError
|
||||||
|
status_code(43)
|
||||||
|
error_key(:ssh_connection_refused)
|
||||||
|
end
|
||||||
|
|
||||||
class SSHKeyBadPermissions < VagrantError
|
class SSHKeyBadPermissions < VagrantError
|
||||||
status_code(12)
|
status_code(12)
|
||||||
error_key(:ssh_key_bad_permissions)
|
error_key(:ssh_key_bad_permissions)
|
||||||
|
|
|
@ -70,6 +70,8 @@ module Vagrant
|
||||||
yield SSH::Session.new(ssh)
|
yield SSH::Session.new(ssh)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rescue Errno::ECONNREFUSED
|
||||||
|
raise Errors::SSHConnectionRefused.new
|
||||||
end
|
end
|
||||||
|
|
||||||
# Uploads a file from `from` to `to`. `from` is expected to be a filename
|
# Uploads a file from `from` to `to`. `from` is expected to be a filename
|
||||||
|
@ -94,7 +96,7 @@ module Vagrant
|
||||||
execute(:timeout => env.config.ssh.timeout) do |ssh|
|
execute(:timeout => env.config.ssh.timeout) do |ssh|
|
||||||
Thread.current[:result] = true
|
Thread.current[:result] = true
|
||||||
end
|
end
|
||||||
rescue Errno::ECONNREFUSED, Net::SSH::Disconnect
|
rescue Errno::ECONNREFUSED, Net::SSH::Disconnect, Errors::SSHConnectionRefused
|
||||||
# False, its defaulted above
|
# False, its defaulted above
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,6 +27,13 @@ en:
|
||||||
Vagrant assumes that this means the command failed!
|
Vagrant assumes that this means the command failed!
|
||||||
|
|
||||||
%{command}
|
%{command}
|
||||||
|
ssh_connection_refused: |-
|
||||||
|
SSH connection was refused! This usually happens if the VM failed to
|
||||||
|
boot properly. Some steps to try to fix this: First, try reloading your
|
||||||
|
VM with `vagrant reload`, since a simple restart sometimes fixes things.
|
||||||
|
If that doesn't work, destroy your VM and recreate it with a `vagrant destroy`
|
||||||
|
followed by a `vagrant up`. If that doesn't work, contact a Vagrant
|
||||||
|
maintainer (support channels listed on the website) for more assistance.
|
||||||
ssh_key_bad_permissions: |-
|
ssh_key_bad_permissions: |-
|
||||||
The private key to connect to this box via SSH has invalid 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
|
set on it. The permissions of the private key should be set to 0600, otherwise SSH will
|
||||||
|
|
Loading…
Reference in New Issue