Skip to content

ci: Show exceptions in Ansible logs#103

Merged
richm merged 1 commit intolinux-system-roles:mainfrom
martinpitt:grep-exception
May 1, 2025
Merged

ci: Show exceptions in Ansible logs#103
richm merged 1 commit intolinux-system-roles:mainfrom
martinpitt:grep-exception

Conversation

@martinpitt
Copy link
Copy Markdown
Contributor

Sometimes tests fail with "An exception occurred during task execution." instead of "fatal:". Catch this case as well.


Spotted in linux-system-roles/cockpit#212 where the initial run didn't show the actual failure of tests_port2.yml. I added this commit to that PR as well, and the new run with that commit shows the proper error.

Sometimes tests fail with "An exception occurred during task execution."
instead of "fatal:". Catch this case as well.
set -euo pipefail
for f in tests/*.log; do
if FAIL=$(grep -B100 -A30 "fatal:" "$f"); then
if FAIL=$(grep -E -B100 -A30 "fatal:|An exception occurred" "$f"); then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/linux-system-roles/auto-maintenance/blob/main/check_logs.py#L253 get_errors_from_ansible_log does this and more. We just need to add an option to check_logs.py to print the ansible errors in a 'github action' friendly way.

@richm richm merged commit a029b2e into linux-system-roles:main May 1, 2025
@martinpitt martinpitt deleted the grep-exception branch May 2, 2025 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants