From 5ed0b22c781cf291250cbf92c90428cdf3d2fd3c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 7 Aug 2014 11:53:44 -0700 Subject: [PATCH] communicators/ssh: cleaner error if remote disconnect [GH-4038] --- CHANGELOG.md | 1 + plugins/communicators/ssh/communicator.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd513f3d5..a7a6b8171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ BUG FIXES: - core: Fix crash case when destroying with an invalid provisioner. [GH-4281] - commands/package: base package won't crash with exception [GH-4017] - commands/rsync-auto: Destroyed machines won't raise exceptions. [GH-4031] + - communicators/ssh: Nicer error if remote unexpectedly disconects. [GH-4038] - communicators/winrm: Support `mkdir` [GH-4271] - guests/centos: Fix issues when NFS client is installed by restarting NFS [GH-4088] diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 2438d7442..a4df0c17a 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -517,8 +517,11 @@ module VagrantPlugins begin channel.wait rescue Errno::ECONNRESET, IOError - @logger.info("SSH connection unexpected closed. Assuming reboot or something.") + @logger.info( + "SSH connection unexpected closed. Assuming reboot or something.") exit_status = 0 + rescue Net::SSH::Disconnect + raise Vagrant::Errors::SSHDisconnected end ensure # Kill the keep-alive thread