Skip sub events for non-dict job returns in the event tagger (#69730)#69731
Open
ggiesen wants to merge 1 commit into
Open
Skip sub events for non-dict job returns in the event tagger (#69730)#69731ggiesen wants to merge 1 commit into
ggiesen wants to merge 1 commit into
Conversation
A failing state compilation returns a list of error strings (or a plain string from some renderers) rather than a mapping of per-state results. _fire_ret_load_specific_fun assumed a dict and crashed on ret.items(), logging 'Event iteration failed with exception: list object has no attribute items' at ERROR for every failed compile. The integration tests that assert that message never appears (tests/pytests/integration/states/test_state_test.py) fail whenever they share a run with a failing compile, which is part of the Rocky Linux 9 integration job noise on 3006.x. There are no state tags in a non-dict return, so skip it at debug level instead. Dict-shaped returns keep firing the per-tag failure events unchanged, covered by a new regression pair: the list-return test fails on the previous code via the logged error, and the dict-return test pins the two sub events (old-style dup tag and the namespaced job error tag) with their enriched payload. Fixes saltstack#69730 Refs saltstack#69728
2 tasks
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.
What does this PR do?
Stops the master's event tagger from crashing on non-dict job returns. A failing state compilation returns a list of error strings (or a plain string from some renderers) rather than a mapping of per-state results, and
_fire_ret_load_specific_funassumed a dict:The broad
exceptturned this intoEvent iteration failed with exception: ...logged at ERROR for every failed compile. The integration tests that assert that message never appears (tests/pytests/integration/states/test_state_test.py) fail whenever they share a run with a failing compile - this is the second failure cluster behind the "Rocky Linux 9 integration tcp/zeromq" noise on 3006.x PRs (12 occurrences in run 28764048341 job 85297152499; the first cluster, leaked minion keys, is addressed by #69729 and absent from that run).A non-dict return has no state tags to fire sub events for, so it is now skipped at debug level after the return shape is resolved (the guard also covers the multi-function branches, where
ret.get(fun, {})can produce a non-dict).What issues does this PR fix or reference?
Fixes #69730
Refs #69728
Previous Behavior
Every failing state compilation made the master log
Event iteration failed with exception: 'list' object has no attribute 'items', and the test_state_test integration tests failed on the logged message.New Behavior
Non-dict returns are skipped quietly; dict-shaped returns fire the per-tag failure events exactly as before.
Merge requirements satisfied?
Two regression tests drive the production entry point
fire_ret_loadwith aSUB_EVENTfunction and non-zero retcode: the list-return test reproduces the exact failed-compile load shape and fails on the previous code via the logged error; the dict-return test pins the two sub events (the old-style<state>.<func>duplicate tag and the namespacedsalt/job/<jid>/sub/<id>/error/<fun>tag) with their enriched payload, guarding against overcorrection.Commits signed with GPG?
No