Fix requisite_in crash with exclude and a *_in requisite (#57999)#69778
Open
ggiesen wants to merge 1 commit into
Open
Fix requisite_in crash with exclude and a *_in requisite (#57999)#69778ggiesen wants to merge 1 commit into
ggiesen wants to merge 1 commit into
Conversation
requisite_in's name-resolution fallback scan iterated every top-level entry in the high data, including __exclude__ (a list), and called .startswith() on each -- raising AttributeError: 'OrderedDict' object has no attribute 'startswith' whenever a *_in requisite referenced a bare name not present as an id and an exclude was in effect. Skip non-state entries in that scan, matching the guard already used by the top-level requisite_in loop. Fixes saltstack#57999
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?
Fixes a state compiler crash:
requisite_inraisedAttributeError: 'OrderedDict' object has no attribute 'startswith'when anexcludewas combined with a*_inrequisite whose target is a bare name not present as an id.What issues does this PR fix or reference?
Fixes #57999
Previous Behavior
When resolving a
*_inrequisite (e.g.require_in,onchanges_in) whose target is a bare name not directly present as an id,requisite_infalls back to scanning every state in the high data to match onname. That scan iterated every top-level entry, including__exclude__-- which is a list, not a state body -- and called.startswith("__")on its elements, raising:requisite_inruns beforeapply_exclude, so__exclude__is still present in the high data. Any highstate that combined anexclude(by id or sls) with such a requisite aborted with this traceback instead of compiling.New Behavior
The fallback scan skips non-state entries such as
__exclude__, matching theisinstance(body, dict)guard already used by the top-level loop in the same method. The highstate compiles normally.Merge requirements satisfied?
changelog/57999.fixed.mdtest_requisite_in_with_exclude_does_not_raise(fails on current code with the reported AttributeError, passes with the fix)Commits signed with GPG?
No