salt icon indicating copy to clipboard operation
salt copied to clipboard

Event Data structure is different depending on Salt topology

Open spo0nman opened this issue 11 years ago • 4 comments

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 avatar Aug 20 '15 08:08 spo0nman

@spo0nman, thanks for the report.

jfindlay avatar Aug 20 '15 18:08 jfindlay

ugly issue :(

DanyC97 avatar Aug 21 '15 18:08 DanyC97

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?

revellion avatar Dec 09 '16 20:12 revellion

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.

stale[bot] avatar Aug 03 '18 16:08 stale[bot]