diff --git a/changelogs/fragments/winrm-all-timeout-exceptions.yaml b/changelogs/fragments/winrm-all-timeout-exceptions.yaml new file mode 100644 index 0000000000..589635e5bc --- /dev/null +++ b/changelogs/fragments/winrm-all-timeout-exceptions.yaml @@ -0,0 +1,4 @@ +--- +minor_changes: + - Catch all connection timeout related exceptions and raise + AnsibleConnectionError instead diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 7c020b142e..4564ef76ed 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -489,7 +489,7 @@ class Connection(ConnectionBase): % (to_native(response.std_out), to_native(stderr))) return response - except requests.exceptions.ConnectionError as exc: + except requests.exceptions.Timeout as exc: raise AnsibleConnectionFailure('winrm connection error: %s' % to_native(exc)) finally: if command_id: