Add support to only return failed states to slack.#46840
Merged
cachedout merged 3 commits intosaltstack:developfrom Apr 5, 2018
Merged
Add support to only return failed states to slack.#46840cachedout merged 3 commits intosaltstack:developfrom
cachedout merged 3 commits intosaltstack:developfrom
Conversation
cachedout
suggested changes
Apr 4, 2018
| as_user, | ||
| api_key) | ||
| return slack | ||
| return slack No newline at end of file |
Contributor
There was a problem hiding this comment.
Please add a newline below this.
Contributor
Author
There was a problem hiding this comment.
@cachedout Sorry I didnt notice it got deleted. Added back in.
gtmanfred
suggested changes
Apr 4, 2018
| returns = dict((key, value) for key, value in returns.items() if value['result'] is not True or value['changes']) | ||
|
|
||
| if only_show_failed is True: | ||
| returns = dict((key, value) for key, value in returns.items() if value['result'] is not True) |
Contributor
There was a problem hiding this comment.
This should be switched to dictionary interpretation, since we no longer support py2.6.
{key, value for key, value in returns.items() if value['result'] is not True}
This is significantly faster.
Contributor
Author
There was a problem hiding this comment.
@gtmanfred Good to know, updated lines 218 and 221 with new method.
gtmanfred
approved these changes
Apr 4, 2018
Contributor
|
@mwerickso There is a lint error on this change here: https://jenkins.saltstack.com/job/PR/job/salt-pr-lint-n/20708/violations/file/salt/returners/slack_returner.py/ Can you fix that up? |
cachedout
approved these changes
Apr 5, 2018
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?
Add support to only return failed states to slack via slack_retuner.
What issues does this PR fix or reference?
N/A
Previous Behavior
Previously, using
changes: truereturned both states that had changes and states that failed.New Behavior
Now, you can still use
changes: trueto return changed and failed states, or you can useonly_show_failed: trueto only return failed states.Tests written?
No
Commits signed with GPG?
Yes