Reconnect SSH if the session closes

This commit is contained in:
Mitchell Hashimoto 2011-07-21 10:53:01 -07:00
parent 0b34364881
commit fddc058e43
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,6 @@
## 0.8.2 (unreleased)
- Fix issue with SSH disconnects not reconnecting.
## 0.8.1 (July 20, 2011)

View File

@ -76,6 +76,16 @@ module Vagrant
# same options, and use that if possible
session, options = @current_session
if session && options == opts
# Verify that the SSH session is still valid
begin
session.exec!("echo foo")
rescue IOError
# Reset the session, we need to reconnect
session = nil
end
end
if !session || options != opts
env.logger.info("ssh") { "Connecting to SSH: #{env.config.ssh.host} #{opts[:port]}" }