Skip to content

Commit a12badf

Browse files
authored
Retry SSH on ConnectionResetError (#708)
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 fee868d commit a12badf

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
@@ -148,7 +148,7 @@ def run(self, command: str, *args: str, **kwargs: Any) -> base.CommandResult:
148148
cmd = self.encode(command)
149149
try:
150150
rc, stdout, stderr = self._exec_command(cmd)
151-
except paramiko.ssh_exception.SSHException:
151+
except (paramiko.ssh_exception.SSHException, ConnectionResetError):
152152
transport = self.client.get_transport()
153153
assert transport is not None
154154
if not transport.is_active():

0 commit comments

Comments
 (0)