From 0da5d7b65059466315ea57191bef7e3c35aa7ddf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 8 Aug 2014 09:11:25 -0700 Subject: [PATCH] communicators/ssh: clean error on max session [GH-4044] --- CHANGELOG.md | 1 + lib/vagrant/errors.rb | 4 ++++ plugins/communicators/ssh/communicator.rb | 2 ++ templates/locales/en.yml | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7a6b8171..c487dcde8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ BUG FIXES: - 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/ssh: Clean error when max sessions is hit. [GH-4044] - communicators/winrm: Support `mkdir` [GH-4271] - guests/centos: Fix issues when NFS client is installed by restarting NFS [GH-4088] diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 3a8873e1b..33e345b73 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -576,6 +576,10 @@ module Vagrant error_key(:ssh_authentication_failed) end + class SSHChannelOpenFail < VagrantError + error_key(:ssh_channel_open_fail) + end + class SSHConnectEACCES < VagrantError error_key(:ssh_connect_eacces) end diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index a4df0c17a..beab115e1 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -520,6 +520,8 @@ module VagrantPlugins @logger.info( "SSH connection unexpected closed. Assuming reboot or something.") exit_status = 0 + rescue Net::SSH::ChannelOpenFailed + raise Vagrant::Errors::SSHChannelOpenFail rescue Net::SSH::Disconnect raise Vagrant::Errors::SSHDisconnected end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 594b857fd..276cdc41f 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -973,6 +973,11 @@ en: assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong. + ssh_channel_open_fail: |- + Failed to open an SSH channel on the remote end! This typically + means that the maximum number of active sessions was hit on the + SSH server. Please configure your remote SSH server to resolve + this issue. 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