1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add ConnectionError too

This commit is contained in:
Dag Wieers 2018-10-13 03:14:07 +02:00
parent 7cc78c5a04
commit 5fa51f3cd8

View file

@ -176,7 +176,7 @@ try:
from pypsrp.powershell import PowerShell, RunspacePool from pypsrp.powershell import PowerShell, RunspacePool
from pypsrp.shell import Process, SignalCode, WinRS from pypsrp.shell import Process, SignalCode, WinRS
from pypsrp.wsman import WSMan, AUTH_KWARGS from pypsrp.wsman import WSMan, AUTH_KWARGS
from requests.exceptions import ConnectTimeout from requests.exceptions import ConnectionError, ConnectTimeout
except ImportError as err: except ImportError as err:
HAS_PYPSRP = False HAS_PYPSRP = False
PYPSRP_IMP_ERR = err PYPSRP_IMP_ERR = err
@ -244,7 +244,7 @@ class Connection(ConnectionBase):
"psrp connection failure during runspace open: %s" "psrp connection failure during runspace open: %s"
% to_native(e) % to_native(e)
) )
except ConnectTimeout as e: except (ConnectionError, ConnectTimeout) as e:
raise AnsibleConnectionFailure( raise AnsibleConnectionFailure(
"Failed to connect to the host via PSRP: %s" "Failed to connect to the host via PSRP: %s"
% to_native(e) % to_native(e)