From c5e19fe4745a9f4fd46754ae4f03a929d53a272d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 16 Mar 2016 09:50:46 -0400 Subject: [PATCH] Have ssh plugin report on connection error Before the connection would fail and log to trace without anything particularly informative for the client (they just saw 'unexpected error'. Provide a more informative behavior for the client. --- confluent_server/confluent/plugins/shell/ssh.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/plugins/shell/ssh.py b/confluent_server/confluent/plugins/shell/ssh.py index 6c336d98..b6a08eed 100644 --- a/confluent_server/confluent/plugins/shell/ssh.py +++ b/confluent_server/confluent/plugins/shell/ssh.py @@ -72,7 +72,6 @@ class SshShell(conapi.Console): while self.connected: pendingdata = self.shell.recv(8192) if pendingdata == '': - self.datacallback(conapi.ConsoleEvent.Disconnect) return self.datacallback(pendingdata) @@ -103,6 +102,13 @@ class SshShell(conapi.Console): self.password = '' self.datacallback('\r\nlogin as: ') return + except paramiko.ssh_exception.NoValidConnectionsError as e: + self.datacallback(str(e)) + self.inputmode = 0 + self.username = '' + self.password = '' + self.datacallback('\r\nlogin as: ') + return self.inputmode = 2 self.connected = True self.shell = self.ssh.invoke_shell()