Event Data structure is different depending on Salt topology
While debugging a salt reactor, I discovered that the data structure passed to reactor differs and depends on Salt topology.
For example consider the following event:
salt-call -l debug --metadata --master=saltmaster event.send 'tag/myevent' '{ foo:bar }'
When looking for the key foo in a sls, in case of a single salt master and minion interaction. we need to use {{ data[‘data’][’foo’] }} e.g.
{% if data['tag'] == 'tag/mytag' %}
do_something:
local.cmd.run:
- tgt: 'target-host'
- arg:
- "/bin/dosomething {{ data['data']['keys'] }}"
{% endif %}
Now, if there is a two tier master setup, a master and an intermediate masters (syndic) between the salt master and the minion. You would need to use {{ data[‘data’][‘data’][’key’] }}
{% if data['tag'] == 'tag/mytag' %}
do_something:
local.cmd.run:
- tgt: 'target-host'
- arg:
- "/bin/dosomething {{ data[‘data’][‘data’][’key’] }}"
{% endif %}
The current behavior results in a non-standard sls and makes it difficult to port it between various environments. e.g single master staging vs, multi master production. Is there a way to make the SLS more portable? or is it possible to make the master understand that the data comes from another master and needs to be stripped of wrappers.
@spo0nman, thanks for the report.
ugly issue :(
This is still a very troublesome issue. No activity for a year on a possible fix for this?.
Or would it require major code re-write?
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.