salt-call: don't re-use initial pillar if CLI overrides passed #46493
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.
A salt-call run already compiles pillar before executing the specified function. Therefore, a performance improvement was made to re-use that initial pillar data when running states. However, when we just re-use that pillar data, we lose the ability to have custom external pillar modules gain access to CLI pillar overrides. Therefore, this commit changes the code in the state compiler which gathers/re-uses the pillar data so that it only re-uses the existing in-memory pillar data when no CLI pillar overrides were passed.
Refs: 8d6fdb7, #44483
Fixes #46207
Use this walkthrough to check out the PR locally, and then the docker container below can be used to confirm the fix. All docker commands should be run from the root of the git clone of Salt.
Note that what the override doesn't make it into the initial calls to evaluate the ext_pillar, this is because these are run as salt-call is starting up. The final call comes as we're running the highstate though, and does indeed contain the CLI overrides.