Better detect SSh connections closing

This commit is contained in:
Mitchell Hashimoto 2013-03-28 15:48:36 -07:00
parent 361cc1ae40
commit ed038c8c64
2 changed files with 8 additions and 9 deletions

View File

@ -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]

View File

@ -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,