Skip to content

Commit 6be11b4

Browse files
committed
Retry SSH on ConnectionResetError
If a target host temporarily looses connection, for example upon resetting a test VM as part of a parametrized test run, retry the SSH connection the same way it is retried upon an SSH exception. Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
1 parent 8d69308 commit 6be11b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

testinfra/backend/paramiko.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def run(self, command, *args, **kwargs):
135135
command = self.encode(command)
136136
try:
137137
rc, stdout, stderr = self._exec_command(command)
138-
except paramiko.ssh_exception.SSHException:
138+
except (paramiko.ssh_exception.SSHException, ConnectionResetError):
139139
if not self.client.get_transport().is_active():
140140
# try to reinit connection (once)
141141
del self.client

0 commit comments

Comments
 (0)