Skip to content

Commit

Permalink
Retry SSH on ConnectionResetError
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tacerus authored and philpep committed Jul 21, 2023
1 parent dc8f15a commit 4615d29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion testinfra/backend/paramiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def run(self, command, *args, **kwargs):
command = self.encode(command)
try:
rc, stdout, stderr = self._exec_command(command)
except paramiko.ssh_exception.SSHException:
except (paramiko.ssh_exception.SSHException, ConnectionResetError):
if not self.client.get_transport().is_active():
# try to reinit connection (once)
del self.client
Expand Down

0 comments on commit 4615d29

Please sign in to comment.