-
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
Only change mine data if using new allow_tgt feature #56172
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,10 +194,13 @@ def update(clear=False, mine_functions=None): | |
log.error('Function %s in mine.update failed to execute', function_name or function_alias) | ||
log.debug('Error: %s', trace) | ||
continue | ||
mine_data[function_alias] = salt.utils.mine.wrap_acl_structure( | ||
res, | ||
**minion_acl | ||
) | ||
if minion_acl.get('allow_tgt'): | ||
mine_data[function_alias] = salt.utils.mine.wrap_acl_structure( | ||
res, | ||
**minion_acl | ||
) | ||
else: | ||
mine_data[function_alias] = res | ||
return _mine_store(mine_data, clear) | ||
|
||
|
||
|
@@ -213,9 +216,13 @@ def send(name, *args, **kwargs): | |
:param str mine_function: The name of the execution_module.function to run | ||
and whose value will be stored in the salt mine. Defaults to ``name``. | ||
: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. | ||
|
||
: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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
properly. | ||
|
||
Remaining args and kwargs will be passed on to the function to run. | ||
|
||
|
@@ -252,11 +259,15 @@ def send(name, *args, **kwargs): | |
log.error('Function %s in mine.send failed to execute', mine_function or name) | ||
log.debug('Error: %s', trace) | ||
return False | ||
mine_data[name] = salt.utils.mine.wrap_acl_structure( | ||
res, | ||
allow_tgt=allow_tgt, | ||
allow_tgt_type=allow_tgt_type | ||
) | ||
|
||
if allow_tgt: | ||
mine_data[name] = salt.utils.mine.wrap_acl_structure( | ||
res, | ||
allow_tgt=allow_tgt, | ||
allow_tgt_type=allow_tgt_type | ||
) | ||
else: | ||
mine_data[name] = res | ||
return _mine_store(mine_data) | ||
|
||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
be on, at least, version
?