WinRM/PSRP: Add support for unreachable
Currently PSRP connection always fail, even if the system is not reachable. This PR fixes this.
This commit is contained in:
parent
db304c27c7
commit
6693adc9b2
1 changed files with 7 additions and 0 deletions
|
@ -166,6 +166,7 @@ from ansible.plugins.connection import ConnectionBase
|
||||||
from ansible.plugins.shell.powershell import _common_args
|
from ansible.plugins.shell.powershell import _common_args
|
||||||
from ansible.utils.hashing import secure_hash
|
from ansible.utils.hashing import secure_hash
|
||||||
from ansible.utils.path import makedirs_safe
|
from ansible.utils.path import makedirs_safe
|
||||||
|
from requests.exceptions import ConnectTimeout
|
||||||
|
|
||||||
HAS_PYPSRP = True
|
HAS_PYPSRP = True
|
||||||
PYPSRP_IMP_ERR = None
|
PYPSRP_IMP_ERR = None
|
||||||
|
@ -243,6 +244,12 @@ 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:
|
||||||
|
raise AnsibleConnectionFailure(
|
||||||
|
"Failed to connect to the host via PSRP: %s"
|
||||||
|
% to_native(e)
|
||||||
|
)
|
||||||
|
|
||||||
self._connected = True
|
self._connected = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue