fix: ansible-runner bugs and add unit tests#5024
Draft
0spinboson wants to merge 10 commits intofrappe:developfrom
Draft
fix: ansible-runner bugs and add unit tests#50240spinboson wants to merge 10 commits intofrappe:developfrom
0spinboson wants to merge 10 commits intofrappe:developfrom
Conversation
Taken from adityahase/pilot@ab1811a Co-authored-by: Aditya <aditya@adityahase.com>
Systemd-timesyncd is installed by default In newer versions of os and that cause conflict
On ubuntu 20.04, the service name is ssh.service instead of sshd.service So, try to figure out the servic and then reload
Fixes: - Import os directly instead of from ansible.inventory.manager - Add trailing comma to single-host inventory string (prevents ansible treating it as a file path) - Fix verbosity flag (was inverted: 0 for debug, 1 for normal) - Save ansible_job_id from async task runner_on_ok events so polling can find them later Tests: - _parse_tasks output parsing (5 tests) - Inventory format validation (3 tests) - generate_cmdline with/without bastion host (3 tests) - Async job_id detection in runner_on_ok (2 tests) - Event handler dispatch routing (2 tests) - AnsibleAdHoc duration parsing (5 tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6 tasks
Member
|
We're solving Ansible compatibility issue along with 3.14 support. https://github.com/frappe/press/pull/4962/changes Also, please don't send AI-generated code. |
Contributor
Author
yes, I saw the other PR #4220 but didn't see it on the tracker yet, that's what the code linked in this draft PR this is intended to add to (it's not standalone or intended as such). |
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.
Summary
Bug fixes and unit tests for the ansible-runner refactor in #4220. This PR is intended to be merged into #4220 (or cherry-picked).
Fixes:
from ansible.inventory.manager import os→import os(unrelated import side-channel)0 if self.debug else 1→1 if self.debug else 0)ansible_job_idfrom async taskrunner_on_okevents so polling jobs can find them later (was silently lost)Tests (20 tests in
press/tests/test_runner.py):_parse_tasksoutput parsing (5 tests)generate_cmdlinewith/without bastion host (3 tests)runner_on_ok(2 tests)AnsibleAdHocduration parsing (5 tests)Test plan
python -m unittest press.tests.test_runner -v)🤖 Generated with Claude Code