diff options
author | Val <vaygr@users.noreply.github.com> | 2023-09-22 15:41:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 15:41:30 +0200 |
commit | 91f94fb59d2ec3e69ff98649094f838c6d81601b (patch) | |
tree | a7218a5a3cdf8851590583b0348e136c6c8e2e9e | |
parent | ansible-test - Skip pylint test on Python 3.12 (#81706) (diff) | |
download | ansible-91f94fb59d2ec3e69ff98649094f838c6d81601b.tar.xz ansible-91f94fb59d2ec3e69ff98649094f838c6d81601b.zip |
Daemonize follow-up fixes (#81584)
* Ensure binary data transmission in daemonize
* Add changelog fragment
-rw-r--r-- | changelogs/fragments/81584-daemonize-follow-up-fixes.yml | 2 | ||||
-rw-r--r-- | lib/ansible/module_utils/service.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/changelogs/fragments/81584-daemonize-follow-up-fixes.yml b/changelogs/fragments/81584-daemonize-follow-up-fixes.yml new file mode 100644 index 0000000000..5842a0a37c --- /dev/null +++ b/changelogs/fragments/81584-daemonize-follow-up-fixes.yml @@ -0,0 +1,2 @@ +bugfixes: + - "``ansible.module_utils.service`` - ensure binary data transmission in ``daemonize()``" diff --git a/lib/ansible/module_utils/service.py b/lib/ansible/module_utils/service.py index 075adfd9e8..e79f40edbd 100644 --- a/lib/ansible/module_utils/service.py +++ b/lib/ansible/module_utils/service.py @@ -215,9 +215,10 @@ def daemonize(module, cmd): for out in list(fds): if out in rfd: data = os.read(out.fileno(), chunk) - if not data: + if data: + output[out] += to_bytes(data, errors=errors) + else: fds.remove(out) - output[out] += data else: break @@ -248,7 +249,7 @@ def daemonize(module, cmd): data = os.read(pipe[0], chunk) if not data: break - return_data += data + return_data += to_bytes(data, errors=errors) # Note: no need to specify encoding on py3 as this module sends the # pickle to itself (thus same python interpreter so we aren't mixing |