Skip to content

Commit 65f9f74

Browse files
committed
cherry-pick ioerror
1 parent 586c38c commit 65f9f74

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

autosubmit/platforms/paramiko_platform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ def x11_status_checker(self, session, session_fileno):
11701170

11711171
def exec_command(
11721172
self, command, bufsize=-1, timeout=30, get_pty=False, retries=3, x11=False
1173-
) -> Union[tuple[paramiko.Channel, paramiko.Channel, paramiko.Channel], tuple[bool, bool, bool]]:
1173+
) -> Union[tuple[paramiko.ChannelFile, paramiko.ChannelFile, paramiko.ChannelFile], tuple[bool, bool, bool]]:
11741174
"""Execute a command on the SSH server.
11751175
11761176
A new ``.Channel`` is open and the requested command is executed.
@@ -1213,7 +1213,7 @@ def exec_command(
12131213
stdout = chan.makefile('rb', bufsize)
12141214
stderr = chan.makefile_stderr('rb', bufsize)
12151215
return stdin, stdout, stderr
1216-
except (paramiko.SSHException, ConnectionError, socket.error) as e:
1216+
except (paramiko.SSHException, ConnectionError, socket.error, IOError) as e:
12171217
Log.warning(f'A networking error occurred while executing command [{command}]: {str(e)}')
12181218
if not self.connected or not self.transport or not self.transport.active:
12191219
self.restore_connection(None)

test/integration/test_paramiko_platform.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,14 @@ def test_exec_command_ssh_session_not_active(
538538
[
539539
paramiko.ssh_exception.NoValidConnectionsError({'192.168.0.1': ValueError('failed')}), # type: ignore
540540
ConnectionError('Someone unplugged the networking cable.'),
541-
socket.error('A random socket error occurred!')
541+
socket.error('A random socket error occurred!'),
542+
IOError('Someone plugged the cable off.')
542543
],
543544
ids=[
544545
'paramiko ssh exception',
545546
'connection error',
546-
'socket error'
547+
'socket error',
548+
'io error'
547549
]
548550
)
549551
@pytest.mark.ssh

0 commit comments

Comments
 (0)