ffdc: Trigger paramiko exec_command() timeout mechanism
Add data read/write operation to trigger paramiko exec_command() timeout mechanism.
Reading channel status does not activate the timeout mechanism.
Test:
- Regression test to openbmc, ubuntu, rhel with standard config and plugins
Change-Id: Ib65304dbbfc1f2df592296e5b5025c928cef86d4
Signed-off-by: Peter D Phan <peterp@us.ibm.com>
diff --git a/ffdc/lib/ssh_utility.py b/ffdc/lib/ssh_utility.py
index 137fd79..ea5cf4f 100644
--- a/ffdc/lib/ssh_utility.py
+++ b/ffdc/lib/ssh_utility.py
@@ -90,6 +90,10 @@
self.sshclient.exec_command(command, timeout=default_timeout)
start = time.time()
while time.time() < start + default_timeout:
+ # Need to do read/write operation to trigger
+ # paramiko exec_command timeout mechanism.
+ xresults = stdout.readlines()
+ results = ''.join(xresults)
if stdout.channel.exit_status_ready():
break
time.sleep(1)
@@ -100,7 +104,7 @@
out = ''
for item in stderr.readlines():
err += item
- for item in stdout.readlines():
+ for item in results:
out += item
return cmd_exit_code, err, out
diff --git a/ffdc/plugins/ssh_execution.py b/ffdc/plugins/ssh_execution.py
index f50d195..0be7c19 100644
--- a/ffdc/plugins/ssh_execution.py
+++ b/ffdc/plugins/ssh_execution.py
@@ -50,7 +50,7 @@
response: stdout from remote host
"""
cmd_exit_code, err, response = \
- ssh_remoteclient.execute_command(command, timeout)
+ ssh_remoteclient.execute_command(command, int(timeout))
# Close ssh session
if ssh_remoteclient: