Skip to content

Conversation

@0spinboson
Copy link
Contributor

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 osimport os (unrelated import side-channel)
  • Add trailing comma to single-host inventory string — without it, ansible treats the string as a file path instead of a host list
  • Fix inverted verbosity flag (0 if self.debug else 11 if self.debug else 0)
  • Save ansible_job_id from async task runner_on_ok events so polling jobs can find them later (was silently lost)

Tests (20 tests in press/tests/test_runner.py):

  • _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)

Test plan

  • All 20 tests pass (python -m unittest press.tests.test_runner -v)
  • Manual test with a real playbook run

🤖 Generated with Claude Code

tanmoysrt and others added 10 commits December 15, 2025 15:26
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>
@adityahase
Copy link
Member

adityahase commented Feb 9, 2026

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.

@0spinboson
Copy link
Contributor Author

0spinboson commented Feb 9, 2026

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.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants