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.
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
[3006.x] Fix x509_v2 state without changes can trigger file module to run in test mode #64269
[3006.x] Fix x509_v2 state without changes can trigger file module to run in test mode #64269
Changes from all commits
417f9d8
e3c4c37
9e5f86f
c7d8c2d
bfe1983
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the fix be in
state.single
if that call is what is causing the overwrite in__opts__
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect the problem is somewhere in the loader, though I'm neither qualified nor motivated to find out tbh. I have tried to debug a very similar problem with overriding
__opts__
not being reversed in the Vault runner before. Also not sure if this workaround can be applied tostate.single
easily.This specific bug breaks the x509_v2 state module pretty hard though and I suspect it will take a bit of time until someone figures out the root cause, if at all (since it's not a huge deal for most of Salt).
Edit: Note that in addition, by avoiding
state.single
this should run quite a bit more performant.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ch3LL can we merge it as is? It's a huge issue in 3006.x since there is a problem installing mcrypto to onedir and the only other way to use x509 state is to use x509_v2 which has that issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lkubb Mind checking the
file.directory
issue reported here #64195 (comment) ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Oloremo Without having much to go on regarding the report, I fail to see how
file.directory
would behave differently with this patch atm. If anything, I would expect it the other way around (test
to not be respected). Usingfile.directory
instead offile.managed
for the reproduction test in this PR succeeds as well. So my current assumption is that it's an unrelated issue or the patch was not applied correctly, barring any future (and more detailed) reports.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bug is nicely distilled in this issue #62590. I think this should be addressed between
salt/state.py
andsalt/loader/lazy.py
which would fix it for all cases where we could run into this, not justx509_v2
.I've done some preliminary investigation and think this is something we can address in a 3006.x maintenance release.
We want all of Salt's dunders to be managed by the loader. Using
func_globals_inject
should be considered an anti-pattern.We'd like to get to a place where opts is no longer mutable. This means in the long run we'll have to figure how a better way to handle
__opts__["test"]
. Currently the loader adds__opts__
to the modules it imports (at import time). The loader adds a copy of opts, not opts itself. This means updating__opts__["test"]
orloader.opts
after a loader has imported a module won't have any affect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that bug has the same source as the sticky
__opts__
causing this issue withstate.single
or fixing that bug will remove the necessity for usingstate.single
instead of__states__
here in the first place?The problem is that the
x509_v2
state module also overridestest
for early checks to avoid signing certificates that are discarded directly after, e.g. by a missing parent dir withoutmakedirs
. So if it does not have the same cause, a restructuring of thex509_v2
state module would still be necessary (not the end of the world though).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should need to refactor
x509_v2
after fixing the bug. I will pull in your tests to the PR where this gets fixed so we can validate the issue is resolved.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dwoz
It's been a month, any updates on this issue? I believe it block literally everyone who wants to use 3006.x and x509
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#64960 addresses this issue. I think this PR can be closed.