From 4a1a9904911e770595b833612c07ee04317c8b25 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 6 Feb 2013 18:08:55 -0800 Subject: [PATCH] Raise a proper SSH error on ECONNRESET --- lib/vagrant/errors.rb | 4 ++++ plugins/communicators/ssh/communicator.rb | 4 ++++ templates/locales/en.yml | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 7de28415a..edc8fa4b1 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -339,6 +339,10 @@ module Vagrant error_key(:ssh_connection_refused) end + class SSHConnectionReset < VagrantError + error_key(:ssh_connection_reset) + end + class SSHConnectionTimeout < VagrantError error_key(:ssh_connection_timeout) end diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index ec0ba6cd6..e4f87a643 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -215,6 +215,10 @@ module VagrantPlugins rescue Errno::ECONNREFUSED # This is raised if we failed to connect the max amount of times raise Vagrant::Errors::SSHConnectionRefused + rescue Errno::ECONNRESET + # This is raised if we failed to connect the max number of times + # due to an ECONNRESET. + raise Vagrant::Errors::SSHConnectionReset rescue Errno::EHOSTDOWN # This is raised if we get an ICMP DestinationUnknown error. raise Vagrant::Errors::SSHHostDown diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b3cfc1648..1a4867397 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -235,6 +235,13 @@ en: 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_connection_reset: |- + SSH connection was reset! This usually happens when the machine is + taking too long to reboot. First, try reloading your machine with + `vagrant reload`, since a simple restart sometimes fixes things. + If that doesn't work, destroy your machine and recreate it with + a `vagrant destroy` followed by a `1vagrant up`. If that doesn't work, + contact support. ssh_connection_timeout: |- Vagrant timed out while attempting to connect via SSH. This usually means that the VM booted, but there are issues with the SSH configuration