diff --git a/changelogs/fragments/winrm-input-failures.yaml b/changelogs/fragments/winrm-input-failures.yaml new file mode 100644 index 0000000000..138d95811e --- /dev/null +++ b/changelogs/fragments/winrm-input-failures.yaml @@ -0,0 +1,2 @@ +bugfixes: +- winrm - Fix issue when attempting to parse CLIXML on send input failure diff --git a/lib/ansible/plugins/connection/winrm.py b/lib/ansible/plugins/connection/winrm.py index 87d1d66d8e..4309a5d88b 100644 --- a/lib/ansible/plugins/connection/winrm.py +++ b/lib/ansible/plugins/connection/winrm.py @@ -481,8 +481,8 @@ class Connection(ConnectionBase): except ValueError: # stdout does not contain a return response, stdin input was a fatal error stderr = to_bytes(response.std_err, encoding='utf-8') - if self.is_clixml(stderr): - stderr = self.parse_clixml_stream(stderr) + if stderr.startswith(b"#< CLIXML"): + stderr = _parse_clixml(stderr) raise AnsibleError('winrm send_input failed; \nstdout: %s\nstderr %s' % (to_native(response.std_out), to_native(stderr)))