Have add_log() set an ATEX note, final report_atex() clears it#583
Merged
matusmarhefka merged 1 commit intomainfrom Apr 1, 2026
Merged
Have add_log() set an ATEX note, final report_atex() clears it#583matusmarhefka merged 1 commit intomainfrom
add_log() set an ATEX note, final report_atex() clears it#583matusmarhefka merged 1 commit intomainfrom
Conversation
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>
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.
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 anypartial=Truereported previous note, which is probably what we want here anyway.Theoretically, we might want to
report_atex(note="bla", partial=True)and havereport_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 - presetnote=to something temporary that gets cleared later.This was actually seen recently on
8.10@ppc64lefor/hardening/host-os/ansible/stigwhich reportederrorwithoutput.txt ansible-playbook.log, but with no note or explanation for theerror, which seemed weird. And theoutput.txtitself had noERRORfromreport_plaintext(), so this very likely came from the partial report.