fix(minion): run own job when target id equals a managed resource id - #69868
Open
n0liu wants to merge 1 commit into
Open
fix(minion): run own job when target id equals a managed resource id#69868n0liu wants to merge 1 commit into
n0liu wants to merge 1 commit into
Conversation
twangboy
requested changes
Jul 27, 2026
twangboy
left a comment
Contributor
There was a problem hiding this comment.
Looks good. We fix bugs on the earliest branch where the bug exists. Resources were added in 3008. Please rebase this on the the 3008.x branch.
n0liu
force-pushed
the
fix/minion-self-job-resource-id-collision
branch
from
July 28, 2026 03:42
76e7891 to
377758b
Compare
Author
|
Thanks for the review, @twangboy! Done — I've rebased this onto I re-verified the fix on |
twangboy
approved these changes
Jul 28, 2026
When a minion's own id is also one of its managed resource ids, a bare (wildcard-free) glob target equal to that id was classified as a pure resource target. `_target_load` then set `minion_is_target` to False, so the minion dispatched the job to the resource but skipped running it locally. Exclude the minion's own id from the bare-id resource match in `_is_pure_resource_target`, so such a target is no longer pure-resource and the minion runs the job itself in addition to the resource. Fixes saltstack#69867
twangboy
force-pushed
the
fix/minion-self-job-resource-id-collision
branch
from
July 28, 2026 16:10
377758b to
ed078e2
Compare
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 #69867.
When a minion's own id is also one of its managed resource ids, a bare (wildcard-free) glob target equal to that id is misclassified as a pure resource target.
_target_loadthen setsminion_is_targettoFalse, so the minion dispatches the job to the matching resource but skips running it on itself.The offending branch in
Minion._is_pure_resource_targetmatches any bare glob against every managed resource id without excluding the minion's own id:How does this PR fix it?
Exclude the minion's own id from that bare-id match:
A target equal to the minion's own id is therefore no longer "pure resource", so
minion_is_targetstaysTrueand the minion runs the job locally in addition to dispatching it to the resource. A bare id that is only a resource id (not the minion's own) is unaffected.Tests
Added
test_pure_resource_target_excludes_own_minion_idintests/pytests/unit/test_minion_resources.py. It builds a minion whose id (dummy-01) is also a managed resource id and asserts:_is_pure_resource_targetisFalsefor the own-id target (fails before this change, passes after),Truefor a different resource id (dummy-02), guarding against over-correction.python -m pytest tests/pytests/unit/test_minion_resources.py— 62 passed locally.