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>
pull/14906/head
Devananda van der Veen 8 years ago
parent 9318727021
commit 08f270ad71
No known key found for this signature in database
GPG Key ID: 845BEE06788983A7

@ -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…
Cancel
Save