server_key, host, port, args)
args.append(command)
- while 1:
+ for x in xrange(retry or 3):
# connects to the remote host and starts a remote connection
proc = subprocess.Popen(args,
stdout = subprocess.PIPE,
try:
out, err = _communicate(proc, stdin, timeout, err_on_timeout)
+ if proc.poll() and err.strip().startswith('ssh: '):
+ # SSH error, can safely retry
+ continue
break
except RuntimeError,e:
if retry <= 0: