From f271d02a9fa07299ea4fccbd7554a1bcec1782dc Mon Sep 17 00:00:00 2001 From: jakegatsby <39974194+jakegatsby@users.noreply.github.com> Date: Thu, 4 Feb 2021 19:01:07 -0500 Subject: [PATCH] bugfix: use to_text(stdout) in psrp.Connection.put_file method (#73491) Co-authored-by: jakegatsby --- changelogs/fragments/psrp-json-loads-bytes.yml | 2 ++ lib/ansible/plugins/connection/psrp.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/psrp-json-loads-bytes.yml diff --git a/changelogs/fragments/psrp-json-loads-bytes.yml b/changelogs/fragments/psrp-json-loads-bytes.yml new file mode 100644 index 00000000000..870461151e9 --- /dev/null +++ b/changelogs/fragments/psrp-json-loads-bytes.yml @@ -0,0 +1,2 @@ +bugfixes: + - to_text(stdout) before json.loads in psrp.Connection.put_file in case stdout is bytes diff --git a/lib/ansible/plugins/connection/psrp.py b/lib/ansible/plugins/connection/psrp.py index 81b77c68cb2..9e73382d9b5 100644 --- a/lib/ansible/plugins/connection/psrp.py +++ b/lib/ansible/plugins/connection/psrp.py @@ -472,7 +472,7 @@ class Connection(ConnectionBase): if rc != 0: raise AnsibleError(to_native(stderr)) - put_output = json.loads(stdout) + put_output = json.loads(to_text(stdout)) remote_sha1 = put_output.get("sha1") if not remote_sha1: