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

Slack webhook returner #55342

Merged
merged 2 commits into from
Nov 26, 2019
Merged

Conversation

cdalvaro
Copy link
Contributor

What does this PR do?

Merge slack_webhook returner from develop branch.

50071631-bbfa1700-01d2-11e9-87a8-b13f612bbff2

What issues does this PR fix or reference?

More information is available in PR #50879

Tests written?

Yes

Commits signed with GPG?

Yes

@cdalvaro cdalvaro requested a review from a team as a code owner November 18, 2019 07:17
@ghost ghost requested a review from xeacott November 18, 2019 07:18
@Akm0d Akm0d added this to the Approved milestone Nov 20, 2019
@Akm0d
Copy link
Contributor

Akm0d commented Nov 20, 2019

re-run full proxy

@Akm0d
Copy link
Contributor

Akm0d commented Nov 20, 2019

re-run full m2crypto

1 similar comment
@Akm0d
Copy link
Contributor

Akm0d commented Nov 21, 2019

re-run full m2crypto

@Akm0d
Copy link
Contributor

Akm0d commented Nov 25, 2019

re-run full amazon2

@dwoz dwoz merged commit 888edcb into saltstack:master Nov 26, 2019
@max-arnold
Copy link
Contributor

@cdalvaro The returner crashes for simple functions like test.ping:

sudo salt minion1 test.ping --return slack_webhook

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/minion.py", line 1805, in _thread_return
    minion_instance.returners[returner_str](ret)
  File "/usr/lib/python3/dist-packages/salt/returners/slack_webhook_return.py", line 330, in returner
    report = _generate_report(ret, show_tasks)
  File "/usr/lib/python3/dist-packages/salt/returners/slack_webhook_return.py", line 220, in _generate_report
    returns.items(),
AttributeError: 'bool' object has no attribute 'items'

The reason is that the ret dictionary looks like this:

{'success': True, 'return': True, 'retcode': 0, 'jid': '20200112092012145203', 'fun': 'test.ping', 'fun_args': [], 'id': 'minion1'}

and the returner tries to iterate over True.items(). The return key can contain arbitrary values and data structures.

@max-arnold
Copy link
Contributor

Also, it is not mentioned in the docs: https://docs.saltstack.com/en/master/ref/returners/all/index.html

@cdalvaro
Copy link
Contributor Author

Thank you for the reporting @max-arnold, I will fix it asap! 🛠

Have you detected more issues related with this returner??

@max-arnold
Copy link
Contributor

@cdalvaro I haven't used it heavily yet, so those two problems is all I was able to find.

Overall, the resulting Slack message looks much nicer than raw json dump from the old slack returner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants