mirror of
https://github.com/ansible/ansible.git
synced 2026-08-02 08:03:18 +02:00
* psrp - ReadTimeout exceptions now mark host as unreachable
* add try to _exec_psrp_script
* fix indent E111
* update raise format
switch to raise Exception from e
---------
(cherry picked from commit 9fcf1f7c58)
Co-authored-by: Michał Gąsior <rogacz@gmail.com>
This commit is contained in:
co-authored by
Michał Gąsior
parent
b09dfd6316
commit
e93bc92d97
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- psrp - ReadTimeout exceptions now mark host as unreachable instead of fatal (https://github.com/ansible/ansible/issues/85966)
|
||||
@@ -331,7 +331,7 @@ try:
|
||||
from pypsrp.host import PSHost, PSHostUserInterface
|
||||
from pypsrp.powershell import PowerShell, RunspacePool
|
||||
from pypsrp.wsman import WSMan
|
||||
from requests.exceptions import ConnectionError, ConnectTimeout
|
||||
from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
|
||||
except ImportError as err:
|
||||
HAS_PYPSRP = False
|
||||
PYPSRP_IMP_ERR = err
|
||||
@@ -479,11 +479,16 @@ class Connection(ConnectionBase):
|
||||
pwsh_in_data = in_data
|
||||
display.vvv(u"PSRP: EXEC %s" % script, host=self._psrp_host)
|
||||
|
||||
rc, stdout, stderr = self._exec_psrp_script(
|
||||
script=script,
|
||||
input_data=pwsh_in_data.splitlines() if pwsh_in_data else None,
|
||||
arguments=script_args,
|
||||
)
|
||||
try:
|
||||
rc, stdout, stderr = self._exec_psrp_script(
|
||||
script=script,
|
||||
input_data=pwsh_in_data.splitlines() if pwsh_in_data else None,
|
||||
arguments=script_args,
|
||||
)
|
||||
except ReadTimeout as e:
|
||||
raise AnsibleConnectionFailure(
|
||||
"HTTP read timeout during PSRP script execution"
|
||||
) from e
|
||||
return rc, stdout, stderr
|
||||
|
||||
def put_file(self, in_path: str, out_path: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user