Skip to content

Commit ff851c0

Browse files
author
Alexandre Vincent
committed
[fix] Workaround channel.recv_exit_status not accepting timeout param
1 parent 3a45fd9 commit ff851c0

File tree

1 file changed

+6
-1
lines changed
  • openwisp_controller/connection/connectors

1 file changed

+6
-1
lines changed

openwisp_controller/connection/connectors/ssh.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ def exec_command(
196196
logger.exception(e)
197197
raise e
198198
# store command exit status
199-
exit_status = stdout.channel.recv_exit_status()
199+
# workaround https://github.com/paramiko/paramiko/issues/1815
200+
# workaround https://github.com/paramiko/paramiko/issues/1787
201+
# Ref. https://docs.paramiko.org/en/stable/api/channel.html#paramiko.channel.Channel.recv_exit_status # noqa
202+
stdout.channel.status_event.wait(timeout=timeout)
203+
assert stdout.channel.status_event.is_set()
204+
exit_status = stdout.channel.exit_status
200205
# log standard output
201206
# try to decode to UTF-8, ignoring unconvertible characters
202207
# https://docs.python.org/3/howto/unicode.html#the-string-type

0 commit comments

Comments
 (0)