From 4f1a3dad8ce8f2adf7391eb0af1763715dae17de Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 31 Mar 2013 20:27:08 -0700 Subject: [PATCH] Retry SSH on Errno::EACCES --- CHANGELOG.md | 1 + lib/vagrant/errors.rb | 4 ++++ plugins/communicators/ssh/communicator.rb | 4 ++++ templates/locales/en.yml | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0ecb8795..4b8803675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ BUG FIXES: - Show a human-friendly error if VBoxManage is not found (exit status 126). [GH-934] - Action hook prepend/append will only prepend or append once. + - Retry SSH on Errno::EACCES. ## 1.1.4 (March 25, 2013) diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 6f2bc79c9..fbe062fe1 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -351,6 +351,10 @@ module Vagrant error_key(:ssh_authentication_failed) end + class SSHConnectEACCES < VagrantError + error_key(:ssh_connect_eacces) + end + class SSHConnectionRefused < VagrantError error_key(:ssh_connection_refused) end diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index b5149b985..4ea9c73af 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -168,6 +168,7 @@ module VagrantPlugins # errors that are generally fixed from a retry and don't # necessarily represent immediate failure cases. exceptions = [ + Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ECONNRESET, @@ -203,6 +204,9 @@ module VagrantPlugins end end end + rescue Errno::EACCES + # This happens on connect() for unknown reasons yet... + raise Vagrant::Errors::SSHConnectEACCES rescue Errno::ETIMEDOUT, Timeout::Error # This happens if we continued to timeout when attempting to connect. raise Vagrant::Errors::SSHConnectionTimeout diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 3ce80cbe0..aa370a7f7 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -276,6 +276,11 @@ en: Vagrant assumes that this means the command failed! %{command} + ssh_connect_eacces: |- + SSH is getting permission denied errors when attempting to connect + to the IP for SSH. This is usually caused by network rules and not being + able to connect to the specified IP. Please try changing the IP on + which the guest machine binds to for SSH. 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