Skip to content

Have add_log() set an ATEX note, final report_atex() clears it#583

Merged
matusmarhefka merged 1 commit intomainfrom
add_note_to_addlog
Apr 1, 2026
Merged

Have add_log() set an ATEX note, final report_atex() clears it#583
matusmarhefka merged 1 commit intomainfrom
add_note_to_addlog

Conversation

@comps
Copy link
Copy Markdown
Contributor

@comps comps commented Mar 31, 2026

This works because a JSON null value is always used for removing previously-reported keys in ATEX; even if the key (note) didn't exist before, a null is not added, the key is discarded.

So passing {..., "note": null, ...} is always safe, and it clears any partial=True reported previous note, which is probably what we want here anyway.

Theoretically, we might want to report_atex(note="bla", partial=True) and have report_and_exit() reuse it, but that seems rather obscure and likely not something we would use. We are far more likely to do what this commit does - preset note= to something temporary that gets cleared later.


This was actually seen recently on 8.10@ppc64le for /hardening/host-os/ansible/stig which reported error with output.txt ansible-playbook.log, but with no note or explanation for the error, which seemed weird. And the output.txt itself had no ERROR from report_plaintext(), so this very likely came from the partial report.

This works because a JSON null value is always used for removing
previously-reported keys in ATEX; even if the key ('note') didn't
exist before, a null is not added, the key is discarded.

So passing {..., "note": null, ...} is always safe, and it clears
any partial=True reported previous note, which is probably what
we want here anyway.

Theoretically, we might want to report_atex(note="bla", partial=True)
and have report_and_exit() reuse it, but that seems rather obscure
and likely not something we would use. We are far more likely to
do what this commit does - preset note= to something temporary that
gets cleared later.

Signed-off-by: Jiri Jaburek <comps@nomail.dom>
Copy link
Copy Markdown
Contributor

@matusmarhefka matusmarhefka left a comment

Choose a reason for hiding this comment

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

LGTM

@matusmarhefka matusmarhefka merged commit 4895e5e into main Apr 1, 2026
4 checks passed
@matusmarhefka matusmarhefka deleted the add_note_to_addlog branch April 1, 2026 09:43
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