I was reviewing the code per my other bug report -- at one point I thought maybe the commands were timing out. I noticed a timeout isn't included in exec_command(). I'm wondering if that might be something you want to add, i.e.,
def run_cmds(self, ssh_job,):
for rho_cmd in ssh_job.rho_cmds:
output = []
for cmd_string in rho_cmd.cmd_strings:
- stdin, stdout, stderr = self.ssh.exec_command(cmd_string)
- output.append((stdout.read(), stderr.read()))
+ try:
+ stdin, stdout, stderr = self.ssh.exec_command(cmd_string, timeout=30)
+ output.append((stdout.read(), stderr.read()))
+ except paramiko.SSHException as e:
+ log.error("Exception on %s: %s" % (ssh_job.ip, e))
rho_cmd.populate_data(output)
Also, on the catch, perhaps stdin, stdout, stderr ought to be set to "", "", "". ...And the value of 30 was arbitrary.
I was reviewing the code per my other bug report -- at one point I thought maybe the commands were timing out. I noticed a timeout isn't included in exec_command(). I'm wondering if that might be something you want to add, i.e.,
Also, on the catch, perhaps stdin, stdout, stderr ought to be set to "", "", "". ...And the value of 30 was arbitrary.