Forward ansible-runner subprocess stderr to job output - #111
Open
adamruzicka wants to merge 3 commits into
Open
Conversation
Contributor
Author
|
CI should be addressed by #112 |
jakduch
reviewed
Aug 19, 2026
| @process_manager.stdin.close unless @process_manager.done? | ||
| end | ||
|
|
||
| def set_process_manager_callbacks(pm) |
Contributor
There was a problem hiding this comment.
Would it make sense to add a small regression test for this callback, perhaps checking that stderr is passed to broadcast_data? That would help protect the main behavior of this change.
| env['FOREMAN_CALLBACK_DISABLE'] = '1' if @rex_command | ||
| env['SMART_PROXY_ANSIBLE_ENVIRONMENT_FILE'] = Proxy::Ansible::Plugin.settings[:ansible_environment_file] | ||
| command = ['ansible-runner', 'run', @root, '-p', 'playbook.yml'] | ||
| command = ['ansible-runner', '-q', 'run', @root, '-p', 'playbook.yml'] |
Contributor
There was a problem hiding this comment.
Maybe the same test could also verify that the generated command includes -q, since that is important for avoiding duplicate output.
Add two regression tests as requested in PR review: 1. Test that set_process_manager_callbacks routes stderr to broadcast_data 2. Test that start_ansible_runner includes the -q flag in the command These tests protect the main behavior of the PR from future regressions.
Contributor
|
Thanks for considering my review and making the changes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runner::Parent#publish_data is a no-op, so stderr from the subprocess was silently discarded. This change overrides the process manager callbacks to route stderr through broadcast_data instead, making errors such as "ansible-runner: command not found" visible in the job output.
Normal playbook output is captured via artifact files, so ansible-runner's direct stdout/stderr is redundant. The -q flag silences it, ensuring only genuine errors (e.g. command not found) reach the stderr broadcast path.
Original

Patched - ansible-runner missing

Patched - ansible-runner available, but ansible-playbook missing (this comes from ansible-runner's artifacts)
