-
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 parameter named grains_blacklist #49481
Add parameter named grains_blacklist #49481
Conversation
Overall, I like the idea of this feature but I'm not certain about this implementation. Would it not be more efficient to just filter at the point that the grains themselves are generated versus doing this on the instantiation of the LazyLoader? I wonder if we should move this logic to the |
@cachedout |
This is much better. I like this a lot. |
@terminalmage You feel good about this? |
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 needs to have documentation added in doc/ref/configuration/minion.rst
.
In addition, all other whitelists/blacklists that we support in salt use salt.utils.stringutils.expr_match()
to support exact matches, fnmatch.fnmatch()
matches, and regex matches. We should be using it here as well for consistency.
Lastly, rather than doing type checking, we should be setting a default value for this in DEFAULT_MINION_OPTS
in salt/config/__init__.py
. For example:
'grains_blacklist': [],
There should also be an entry for this option in VALID_OPTS
as well, with the valid type being list
.
Hi @terminalmage |
Hi @terminalmage |
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.
Why this is even needed at all? If there is something in the default list, then it needs to be there anyway. If you want only specific keys, then you can already get them. But once you need something that you normally do not need and this "muter" exist, then you have a trouble.
I find this useless, sorry.
@isbm |
Then simply don't ask for all data. Ask only for what you need. But once you do need it but at the same time cannot get it, then I find this a very bad idea. |
The following is the configuration of our production environment, we believe that we cannot need them, but we also believe that others may need.
|
Hi @terminalmage |
Can you write some tests for this new functionality? We wouldn't want this to regress in the future. :) |
- Update the documentation of minion configuration - Use salt.utils.stringutils.expr_match() to support exact matches - Setting a default value in DEFAULT_MINION_OPTS & VALID_OPTS
- fix dict.keys() for python3 - fix the document error
86ded8b
to
4286e1d
Compare
Hi @rallytime . It is done. |
Thanks @rongzeng54! |
This option seems to partially duplicate the existing IMO, having two different ways to do this is confusing. |
[master] Porting #49481 to master
What does this PR do?
Add parameter named grains_blacklist to block the specific grains.
What issues does this PR fix or reference?
No
Previous Behavior
The default grains list, seems getting longer and uncontrolled by the user.
New Behavior
The user finally has a chance to say no.
Of course, only for advanced users because of the dependencies of module.
Tests written?
No
Commits signed with GPG?
No