From ed038c8c64208df4d79c39f7c2ad1ef59233d54e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 28 Mar 2013 15:48:36 -0700 Subject: [PATCH] Better detect SSh connections closing --- CHANGELOG.md | 4 ++++ plugins/communicators/ssh/communicator.rb | 13 ++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e46d73fe1..de0a5bc8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 1.1.5 (unreleased) +IMPROVEMENTS: + + - More robust SSH connection close detection. + BUG FIXES: - Proper error message if invalid provisioner is used. [GH-1515] diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 1418db07a..b5149b985 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -126,15 +126,10 @@ module VagrantPlugins # socket. begin @connection.exec!("") - rescue Errno::EHOSTUNREACH - @logger.info("No route to host for connection. Not re-using.") - @connection = nil - rescue Net::SSH::Disconnect - @logger.info("SSH disconnected. Not-reusing connection.") - @connection = nil - rescue IOError - @logger.info("Connection has been closed. Not re-using.") - @connection = nil + rescue Exception => e + @logger.info("Connection errored, not re-using. Will reconnect.") + @logger.debug(e.inspect) + @conncetion = nil end # If the @connection is still around, then it is valid,