From bca57ec65a37afe1b91ca27c14474eb9562f56cf Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Mon, 8 Feb 2021 09:56:59 +1000 Subject: [PATCH] bugfix: use to_text(stdout) in psrp.Connection.put_file method (#73491) - 2.10 (#73496) (cherry picked from commit f271d02a9fa07299ea4fccbd7554a1bcec1782dc) Co-authored-by: jakegatsby <39974194+jakegatsby@users.noreply.github.com> --- 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..6cc4c18bc42 --- /dev/null +++ b/changelogs/fragments/psrp-json-loads-bytes.yml @@ -0,0 +1,2 @@ +bugfixes: + - psrp connection plugin - ``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 38a6259bcd2..f03eb8782ce 100644 --- a/lib/ansible/plugins/connection/psrp.py +++ b/lib/ansible/plugins/connection/psrp.py @@ -470,7 +470,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: