saltstack / saltstack/salt

[DOCS] Beacons and reactors docs (version 3000.3) incorrect for accessing data dict

Open
#61,616 0 comments 0 reactions 1 assignee View on GitHub

@frogunder is already working on this.

Since Feb 11, 2022.

documentation severity-medium time-estimate-sprint
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
The Salt documentation for beacons and reactors states:

An event initiated by a beacon, when it arrives at the master will be wrapped inside a second event, such that the data object containing the beacon information will be data['data'], rather than data.

For example, to access the id field of the beacon event in a reactor file, you will need to reference {{ data['data']['id'] }} rather than {{ data['id'] }} as for events initiated directly on the event bus.

When I try to access {{ data['data']['id'] }} in a reactor state triggered by a beacon, my state fails to render with SaltRenderError: Jinja variable 'dict object' has no attribute 'data'. Once I switched to using {{ data['id'] }}, it started working.

Suggested Fix
It's possible my understanding of the documentation is incorrect, but the docs seem very explicit about the behavior, and that is not what I am seeing.

Type of documentation
Salt reactor system documentation

Location or format of documentation
https://docs.saltproject.io/en/3003/topics/reactor/index.html#beacons-and-reactors

EDIT: I realize that I misread the version of Salt we are using -- I have linked version 3003.3 of the documentation, but we are actually running version 3000.3 -- that being said, I did check the v3000.3 tag on GitHub and the 'Beacons and Reactos' section appears to be the same.

Additional context
Below is my beacon definition, which is defined in a local pillar file and applied to the minion against which I am testing:

cat /srv/pillar/justin/beacons/init.sls
beacons:
  service:
    - services:
        eap7-standalone:
          onchangeonly: True
          delay: 0
          emitatstartup: False
          uncleanshutdown: /var/opt/rh/eap7/run/wildfly/eap7-standalone.pid

And I have documented the non-working example for my own notes in a OneNote document from which the following screenshot was taken:
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.