Fix prereq chain misfire when an intermediate state reports test changes (#68438)#69376
Open
dwoz wants to merge 1 commit into
Open
Fix prereq chain misfire when an intermediate state reports test changes (#68438)#69376dwoz wants to merge 1 commit into
dwoz wants to merge 1 commit into
Conversation
When a prereq chain is set up as
state1 --prereq--> state2 --prereq--> state3
and state3 produces no changes, state1 should not run because its prereq
on state2 should also report no changes. The middle state was instead
unconditionally re-executed in test mode after its own prereq was
resolved, so any state that always pretends to change in test mode (e.g.
test.succeed_with_changes, module.run) caused the head of the chain to
run even though the tail produced no changes.
In State.call_chunk, when re-checking requisites for a low chunk flagged
__prereq__ after running its sub-requisites, treat a 'pre' status the
same way the non-prereq branch does: synthesize a no-changes result and
skip the state function call. This way the prerequiring caller sees
empty changes and does not run.
Fixes saltstack#68438
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 prereq chain bug where a state at the head of a chain
(
state1 -prereq-> state2 -prereq-> state3) would always run when anintermediate state in the chain always produces changes in test mode
(e.g.
test.succeed_with_changes,module.run), even though the tailstate of the chain produced no changes.
What issues does this PR fix or reference?
Fixes #68438
Previous Behavior
For the chain in the issue:
state1 produced changes even though state3 reported no changes.
New Behavior
state1 reports no changes when the tail of the prereq chain reports no
changes, matching documented prereq semantics.
Merge requirements satisfied?
Commits signed with GPG?
Yes