Skip to content

Commit

Permalink
Separate outputs of kolla_toolbox inner module
Browse files Browse the repository at this point in the history
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/+/929294

Change-Id: Iad0476d4511f28c837794352c9a3e2f47113d9a1
Closes-Bug: #2080544
(cherry picked from commit 5407662)
  • Loading branch information
priteau committed Sep 13, 2024
1 parent a711c35 commit 9e8d8b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ansible/library/kolla_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ def use_docker(module):
"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)
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/kolla-toolbox-demux-c5e8d27bc7214069.yaml
Original file line number Diff line number Diff line change
@@ -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 <https://launchpad.net/bugs/2080544>`__

0 comments on commit 9e8d8b6

Please sign in to comment.