-
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
Cannot pass pillar data to the slack engine #39783
Comments
@mdaffin looking at the code here and when i just pass that through using the python salt-api as shown below it works:
Can you print out kwargs and args on that command and see how its trying to pass this to localclient? |
It might not be working because it looks like this engine is doing it's own name=val parsing and at quick glance it's not clear to me why. LocalClient also performs that work in addition to running args through I might be missing something, but I think the
|
@Ch3LL output as requested:
@whiteinge it does look like that is the case. The above confirms it is just treating the part after the |
Note that since it is a runner command this is what is passed to the |
Oh! facepalm I see now why this module is using that format. I was thinking SLS files but it makes sense that it's parsing textual messages from Slack. Thanks, that makes sense now. In that case, I think we can get this all the way working by simply packing all positional args into |
I am struggling to understand the decision to can to--what would be the process by which one would pass inline pillar data to an orchestration command via slack? |
@nomeelnoj at the moment it looks like only string values can be given as arguments so I don't think it's possible to send Pillar data (which must be a dictionary) from either Slack or as an alias until this change is implemented. |
… for bits. General cleanup and fixing of messages when things go wrong.
Would it be better if the SlackClient parsed messages for aliases or some other special SlackClient syntax but fell back on using salt.client.caller.cmd() parsing since the slack engine commands seem to set up the expectation this is how it works? |
@aphor (Stop me if I'm misreading your question) in my opinion: Commands from Slack should ideally have exactly the same format as the Salt CLI. E.g., typing The Slack-specific aliases and whitelisting would just be value-adds on top of that native behavior to allow for common shortcuts and some light security. |
@whiteinge I think you understood me well. Thanks for the answer. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Description of Issue/Question
Pillar data cannot be passed to the slack engine from slack or the engine config resulting in
Pillar data must be formatted as a dictionary
error message.I expected it to work the same way as the command line. ie you should be able to copy and paste a command from the command line into slack or the
cmd
line in the alias.Setup
/srv/salt/orch/ping.sls
/etc/salt/master.d/slack-engine.conf
Steps to Reproduce Issue
From the salt master running
salt-run state.orchestrate orch.ping pillar='{"target": "web-*"}'
works as expected.In slack running
!state.orchestrate orch.ping pillar='{"target":"web-*"}'
or!ping-web
produces the following error in slack.I have tried a variety of different pillar data, including formatting is as a python dict
'{target: "web-*"}'
.Versions Report
We also saw this in the previous version (2016.11.2).
The text was updated successfully, but these errors were encountered: