[dts] [PATCH] framework: handling _prompt and ssh exceptions
Tu, Lijuan
lijuan.tu at intel.com
Tue May 19 04:00:27 CEST 2020
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Thinh Tran
> Sent: Friday, May 15, 2020 5:19 AM
> To: dts at dpdk.org
> Cc: Thinh Tran <thinhtr at linux.vnet.ibm.com>
> Subject: [dts] [PATCH] framework: handling _prompt and ssh exceptions
>
> We may got two exceptions that are raised one right after the other.
> It seems to be only in python3 failing to handling it.
>
> In this case are TIMEOUTs of the execution of a command and of the ssh
> session:
> ......
> raise TimeoutException(command, self.get_output_all())
> exception.TimeoutException: TIMEOUT on lsof -Fp
> /var/run/dpdk/dpdk_73008_20200514164308/config
> Error in atexit._run_exitfuncs:
> Traceback (most recent call last):
> File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 111,
> in expect_loop
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
> File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py",
> line 509, in read_nonblocking
> raise TIMEOUT('Timeout exceeded.')
> pexpect.exceptions.TIMEOUT: Timeout exceeded.
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 119,
> in expect_loop
> return self.timeout(e)
> File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 82, in
> timeout
> raise TIMEOUT(msg)
> pexpect.exceptions.TIMEOUT: Timeout exceeded.
> <pexpect.pxssh.pxssh object at 0x70b17a7c1be0>
> command: /usr/bin/ssh
> args: [b'/usr/bin/ssh', b'-q', b'-l', b'root', b'9.114.224.16'] buffer (last 100
> chars): ''
> .......
>
> Signed-off-by: Thinh Tran <thinhtr at linux.vnet.ibm.com>
> ---
> framework/ssh_pexpect.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py index
> df610c1..0230207 100644
> --- a/framework/ssh_pexpect.py
> +++ b/framework/ssh_pexpect.py
> @@ -133,7 +133,7 @@ class SSHPexpect:
>
> def __prompt(self, command, timeout):
> if not self.session.prompt(timeout):
> - raise TimeoutException(command, self.get_output_all())
> + raise TimeoutException(command, self.get_output_all()) from
> + None
>
> def __sendline(self, command):
> if not self.isalive():
> --
> 2.17.0
More information about the dts
mailing list