Skip to content
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 support to only return failed states to slack. #46840

Merged
merged 3 commits into from Apr 5, 2018

Conversation

Projects
None yet
4 participants
@mwerickso
Copy link
Contributor

commented Apr 3, 2018

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: true returned both states that had changes and states that failed.

New Behavior

Now, you can still use changes: true to return changed and failed states, or you can use only_show_failed: true to only return failed states.

Tests written?

No

Commits signed with GPG?

Yes

Matthew Erickson Matthew Erickson

@cachedout cachedout requested a review from gtmanfred Apr 4, 2018

@@ -231,4 +241,4 @@ def returner(ret):
username,
as_user,
api_key)
return slack
return slack

This comment has been minimized.

Copy link
@cachedout

cachedout Apr 4, 2018

Collaborator

Please add a newline below this.

This comment has been minimized.

Copy link
@mwerickso

mwerickso Apr 4, 2018

Author Contributor

@cachedout Sorry I didnt notice it got deleted. Added back in.

returns = ret.get('return')
if changes is True:
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)

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Apr 4, 2018

Contributor

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.

This comment has been minimized.

Copy link
@mwerickso

mwerickso Apr 4, 2018

Author Contributor

@gtmanfred Good to know, updated lines 218 and 221 with new method.

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Apr 4, 2018

@cachedout cachedout merged commit 4b6251a into saltstack:develop Apr 5, 2018

5 of 10 checks passed

jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #17829 — ABORTED
Details
codeclimate 1 issue to fix
Details
default Build finished.
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #3782 — FAILURE
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #21542 — FAILURE
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #23945 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #16107 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #8607 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #20726 — SUCCESS
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.