From 76cc9bf10b955143e5ca68244427b69e2931b088 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Thu, 12 Sep 2024 20:19:49 +0200 Subject: [PATCH] Separate outputs of kolla_toolbox inner module Inner modules called by the kolla_toolbox module were returning stdout and stderr as a single output object. This could break JSON parsing if any data was present in stderr, for example warnings such as: [WARNING]: Collection ansible.posix does not support Ansible version 2.14.17 Fix by using demux=True to separate the two streams. The stderr content is logged as it could be useful for troubleshooting or catching deprecation notices. Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/929271 Change-Id: Iad0476d4511f28c837794352c9a3e2f47113d9a1 Closes-Bug: #2080544 (cherry picked from commit 540766203884ab072b65fd1d14eaa75e60696cab) --- ansible/library/kolla_toolbox.py | 4 +++- .../notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml diff --git a/ansible/library/kolla_toolbox.py b/ansible/library/kolla_toolbox.py index 388d678add..83299638f5 100644 --- a/ansible/library/kolla_toolbox.py +++ b/ansible/library/kolla_toolbox.py @@ -181,7 +181,9 @@ def main(): "ANSIBLE_LOAD_CALLBACK_PLUGINS": "True"} job = client.exec_create(kolla_toolbox, command_line, environment=environment, **kwargs) - json_output = client.exec_start(job) + json_output, error = client.exec_start(job, demux=True) + if error: + module.log(msg='Inner module stderr: %s' % error) try: output = json.loads(json_output) diff --git a/releasenotes/notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml b/releasenotes/notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml new file mode 100644 index 0000000000..5142566597 --- /dev/null +++ b/releasenotes/notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes parsing of JSON output of inner modules called by ``kolla-toolbox`` + when data was returned on standard error. + `LP#2080544 `__