1

I am struggling to implement a reactor (or any other method) to have all my minions updated once the salt master gitfs configured remote has changed (so when a commit has been pushed/merged into the branch the salt master is monitoring)

So far I tried to implement a reactor.conf with the following:

---
reactor:
  - salt/fileserver/gitfs/update:
      - filter: data.get('changed', False) == True
      - salt:
          tgt: "*"
          fun: state.apply
          arg:
            highstate: ""

But getting error:

2023-04-14 10:20:05 master01  | [ERROR   ] Exception encountered while compiling reactions
2023-04-14 10:20:05 master01  | Traceback (most recent call last):
2023-04-14 10:20:05 master01  |   File "salt/utils/reactor.py", line 178, in reactions
2023-04-14 10:20:05 master01  |     high.update(self.render_reaction(fn_, tag, data))
2023-04-14 10:20:05 master01  |   File "salt/utils/reactor.py", line 57, in render_reaction
2023-04-14 10:20:05 master01  |     if glob_ref.startswith("salt://"):
2023-04-14 10:20:05 master01  | AttributeError: 'dict' object has no attribute 'startswith'

What would be the right approach here?

tvb
  • 783
  • 1
  • 10
  • 21
  • You appear to have tried to mix the reactor.conf with the reaction.sls into one file, which is why it doesn't compile. – OrangeDog Apr 14 '23 at 16:07

1 Answers1

0

Reactor configuration is supposed to be in two separate files

# /etc/salt/master.d/reactor.conf
reactor:
  - salt/fileserver/gitfs/update:
    - /srv/reactor/gitfs.sls
# /srv/reactor/gitfs.sls
{% if data.get('changed') %}
highstate_run:
  local.state.apply:
    - tgt: '*'
{% endif %}

https://docs.saltproject.io/en/latest/topics/reactor/

OrangeDog
  • 36,653
  • 12
  • 122
  • 207