Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extend+exclude interaction #62862

Merged

Conversation

agraul
Copy link
Contributor

@agraul agraul commented Oct 11, 2022

What does this PR do?

Exclude declarations that are specified in excluded SLS files are ignored. Users don't expect that exluded SLS files have any effect at all. The PR is a bit rough around the edges, I don't mind cleaning it up a bit but first I'd like to have feedback on the approach I took.

I haven't yet checked if None can be in __exclude__. If that never happens, I will remove the sentinel object.

What issues does this PR fix or reference?

Fixes: #62082

Previous Behavior

An SLS file that is excluded affects other states if it contains an extend declaration.

New Behavior

An SLS file that is excluded does not extend other states.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Always

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@agraul agraul requested a review from a team as a code owner October 11, 2022 15:17
@agraul agraul requested review from MKLeb and removed request for a team October 11, 2022 15:17
Copy link
Contributor

@cmcmarrow cmcmarrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for writing tests. For me the pull request looks really nice. I don't know if exclude can hold none. I'll try and find that information for you. But It does not hurt to have it.

@agraul
Copy link
Contributor Author

agraul commented Oct 12, 2022

@cmcmarrow thanks for looking into that open question. Looking at the code again, I think I can remove the sentinel object either way. When I added it, I was doing if body.get("__sls__", sentinel_sls) in high.get("__exclude__", []), but then I realized that the "__exclude__" list can contain dictionaries with "id" or "sls" keys and added the logic to build sls_excludes. And sls_excludes can not include None.

I'll clean that up and squash the commits later today.

@agraul agraul force-pushed the fix/extend-exclude-interaction branch from 35feb69 to d94f750 Compare October 12, 2022 13:08
@agraul agraul requested a review from cmcmarrow October 12, 2022 13:09
changelog/62848.fixed Outdated Show resolved Hide resolved
sls files that are excluded should not affect other sls files by
extending their states. Exclude statements are processed very late in
the state processing pipeline to ensure they are not overridden. By that
time, extend declarations are already processed.

Luckily, it's not necessary to change much, during the extend
declarations processing it is easy to check if the sls file that
contains a given extend declaration is excluded.
@agraul agraul force-pushed the fix/extend-exclude-interaction branch from d94f750 to 856b23c Compare October 13, 2022 13:26
@agraul agraul requested a review from Ch3LL October 13, 2022 13:27
@Ch3LL Ch3LL added the Sulfur v3006.0 release code name and version label Oct 13, 2022
@garethgreenaway garethgreenaway merged commit b59e7ef into saltstack:master Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sulfur v3006.0 release code name and version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Include + exclude + override with a require results in "The following requisites were not found"
4 participants