Add socket timeout errors to list of exceptions
This commit is contained in:
parent
b81ea65b77
commit
579abf3afc
|
@ -1,4 +1,5 @@
|
||||||
from paramiko.ssh_exception import SSHException, NoValidConnectionsError
|
from paramiko.ssh_exception import SSHException, NoValidConnectionsError
|
||||||
|
from socket import timeout
|
||||||
|
|
||||||
class retry:
|
class retry:
|
||||||
"""Decorator used to automatically retry operations throwing exceptions
|
"""Decorator used to automatically retry operations throwing exceptions
|
||||||
|
@ -9,10 +10,11 @@ class retry:
|
||||||
Args:
|
Args:
|
||||||
exceptions (tuple, optional): A tuple containing exception classes
|
exceptions (tuple, optional): A tuple containing exception classes
|
||||||
that should be handled by the decorator. If none, handle only
|
that should be handled by the decorator. If none, handle only
|
||||||
paramiko.ssh_exception.SSHException/NoValidConnectionsError.
|
paramiko.ssh_exception.SSHException/NoValidConnectionsError and
|
||||||
Defaults to None.
|
socket.timeout/TimeoutError. Defaults to None.
|
||||||
"""
|
"""
|
||||||
self.exceptions = exceptions or (SSHException, NoValidConnectionsError)
|
self.exceptions = exceptions or (SSHException, NoValidConnectionsError,
|
||||||
|
timeout, TimeoutError)
|
||||||
|
|
||||||
def __call__(self, f):
|
def __call__(self, f):
|
||||||
"""Return a function through the retry decorator
|
"""Return a function through the retry decorator
|
||||||
|
|
Loading…
Reference in a new issue