summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2021-02-06 07:53:44 +1000
committerGitHub <noreply@github.com>2021-02-05 15:53:44 -0600
commite9838486bd6b7becf9dac0a94852aa320b4479e4 (patch)
tree96db4e98afd8c7d5a9ec6b3efccb7a9d5073f4d6
parentd2688917033eea1a987d7af00ca0df95213b5d09 (diff)
downloadansible-e9838486bd6b7becf9dac0a94852aa320b4479e4.tar.gz
bugfix: use to_text(stdout) in psrp.Connection.put_file method (#73491) - 2.9 (#73495)
* bugfix: use to_text(stdout) in psrp.Connection.put_file method (#73491) Co-authored-by: jakegatsby <jakegatsby@example.com> (cherry picked from commit f271d02a9fa07299ea4fccbd7554a1bcec1782dc)
-rw-r--r--changelogs/fragments/psrp-json-loads-bytes.yml2
-rw-r--r--lib/ansible/plugins/connection/psrp.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/changelogs/fragments/psrp-json-loads-bytes.yml b/changelogs/fragments/psrp-json-loads-bytes.yml
new file mode 100644
index 0000000000..eed43f8c1e
--- /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 38a6259bcd..f03eb8782c 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: