Only change mine data if using new allow_tgt feature#56172
Merged
dwoz merged 3 commits intosaltstack:masterfrom Mar 10, 2020
Merged
Only change mine data if using new allow_tgt feature#56172dwoz merged 3 commits intosaltstack:masterfrom
dwoz merged 3 commits intosaltstack:masterfrom
Conversation
twangboy
approved these changes
Feb 14, 2020
s0undt3ch
approved these changes
Feb 22, 2020
salt/modules/mine.py
Outdated
| :param str allow_tgt: Targeting specification for ACL. Specifies which minions | ||
| are allowed to access this function. | ||
| are allowed to access this function. Please note both your master and | ||
| minion need to be on atleast version 3000 for this to work properly. |
Contributor
There was a problem hiding this comment.
be on, at least, version?
salt/modules/mine.py
Outdated
| :param str allow_tgt_type: Type of the targeting specification. This value will | ||
| be ignored if ``allow_tgt`` is not specified. | ||
| be ignored if ``allow_tgt`` is not specified. Please note both your | ||
| master and minion need to be on atleast version 3000 for this to work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
With the new
allow_tgtfeature in the mine.get the data structure was changed. This PR ensures we only send this new data structure if we are using the newallow_tgtfeature.Fixes the issue in #56118
The initial issue made it so a master on <3000 would not work with a >=3000 minion with mine data. With this PR we only change the data structure if we are using the new feature, so we assume if they are using the new feature they want to use 3000. Also documented that both the master and minion need to be on atleast versions 3000 if using this feature.
This PR also fixes another issue I found. If you set a minion in
allow_tgtthat is a minion that does not actually exist it will return the data regardless. Without this PR given the following config:As you can see above we have defined a minion that does not exist in
allow_tgt, but I can still gather the data for any minion:With this patch, we check to see if the minion even exists, if it does not we do not allow the minion to view the data:
What issues does this PR fix or reference?
Fixes #56118
Previous Behavior
Data returned on a master (<3000) and minion (>=3000), even if not using the new
allow_tgtfeature:New Behavior
Data returned on a master (<3000) and minion (>=3000), even if not using the new
allow_tgtfeature:To note if one is using the
allow_tgtfeature and they have a master <3000 they will see the wrong data (ex,__data__), this feature requires both master and minion are upgraded.Tests written?
Yes
Commits signed with GPG?
Yes