-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add global_state_conditions handling #62717
Add global_state_conditions handling #62717
Conversation
re-run pr-centosstream-9-x86_64-py3-pytest |
re-run pr-freebsd-131-amd64-py3-pytest |
re-run pr-amazon-2-x86_64-py3-pytest |
re-run pr-windows-2019-x64-py3-pytest |
Just one question, does this impact performance dramatically when this feature is enabled? |
Once #62295 is merged, this logic will only add a very small amount of processing time to each state block evaluation , but it should be negligible even at scale (+ ~10sec per 100,000 state blocks)... unless someone decides to abuse the heck out of it and have a ridiculous amount of conditions to evaluate. |
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.
how about calling config.get module instead. that way the configuration can come from multiple points and not need to be limited to a config option only. I'm also not a fan of config file changes. as to make changes to them a restart of the minion needs to happen. this can be disruptive to users environments.
re-run pr-centosstream-9-x86_64-py3-pytest |
re-run pr-macosx-catalina-x86_64-py3-pytest |
1 similar comment
re-run pr-macosx-catalina-x86_64-py3-pytest |
re-run pr-centos-7-x86_64-py3-tcp-pytest |
re-run pr-alma-8-x86_64-py3-pytest |
re-run pr-macosx-catalina-x86_64-py3-pytest |
I'm starting to think that mac test failure is related because its failed on every test run on this PR |
@MKLeb nope. I don't have a Mac. |
Mac tests should be fixed since this is closed: #62829 Will update the branch. |
Can you resolve the merge conflict |
5c8b208
@nicholasmhughes Okay, so I've found what is causing the drastic failures. The test in question is actually touching your changes once (and seemingly only once). On average, with my testing machine, the method you added is taking ~170ms. Specifically, the |
@MKLeb , we suspected
Not sure what your references to millisecond return times have to do with the "spawning platform" tests that are failing for MacOS, but I still don't understand what in particular is happening inside Were you able to narrow the "expensive" operations within |
Ok... So I don't know precisely what is going on, but I do know one thing for sure - Loading EDIT: While I'm not sure this is a complete fix, I would recommend writing some tests for when EDIT 2: I realized I never answered your question about why this is only affecting MacOS. The short answer is that I don't know for sure. There is no logic in |
Made a change that was close to what you proposed. Just moved the call to |
Any reasons why this was merged with no discussion, when all the comments on the feature request were against it? |
The original implementation outlined in the feature request was not put in place. This PR is a broader feature that was discussed in a couple Open Hours. |
Ah, ok. Open Hour discussions should be captured properly. I don't even recall any mention of this in the minutes, |
What does this PR do?
This PR introduces a new minion configuration option which allows for global conditions to be introduced into the state system logic. This should help limit repetitive templating wrappers which are used to enable/disable state blocks in multiple formulas.
What issues does this PR fix or reference?
Fixes: #62446
Previous Behavior
If we want to check a standard condition in Grains, we'd have to template around every state block in which we'd want to perform that check:
New Behavior
Now we only need to set a minion configuration option on the host:
...and then a standard state block such as:
...will not be run on a host which doesn't meet the conditions for the state to be run:
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.