Send empty command before recv
On some switches, starting an SSH connection and immediately calling recv() will result in a connection timeout. The switch requires some input on the channel before it provides any prompt. As such, this patch sends an empty command immediately upon connection, triggering the switch to send a prompt which the shell can then interpret. Signed-off-by: Devananda van der Veen <devananda.vdv@gmail.com>
This commit is contained in:
parent
9318727021
commit
08f270ad71
1 changed files with 1 additions and 0 deletions
|
@ -109,6 +109,7 @@ class Shell(object):
|
|||
|
||||
self.shell = self.ssh.invoke_shell()
|
||||
self.shell.settimeout(10)
|
||||
self.shell.sendall("\n")
|
||||
self.receive()
|
||||
|
||||
def strip(self, data):
|
||||
|
|
Loading…
Reference in a new issue