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

reactor.add | list | delete -> python exception #47833

Closed
blefeuvr opened this Issue May 25, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@blefeuvr

blefeuvr commented May 25, 2018

Hello, I am trying to use reactor, while I couldn't trigger any reactor actions on events, I tried these commands, which all end in the same exception. I don't know to what extend it is connected to my initial problem, but something is obviously not working here. Either I don't understand something, or there is a problem somewhere. Thanks in advance for your welcomed help.

Commands called :

salt-run reactor.list
salt-run reactor.add 'custom/event/tag' reactors='salt://reactor/slack.sls'
salt-run reactor.delete 'custom/event/tag'

Both of the threes end like that :
(this is for reactor.delete but others are mainly identical"

Exception occurred in runner reactor.delete: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/client/mixins.py", line 387, in _low
    data['return'] = self.functions[fun](*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/runners/reactor.py", line 95, in delete
    return res['result']
TypeError: 'NoneType' object has no attribute '__getitem__'

Versions Report

Salt Version:
Salt: 2018.3.0

Dependency Versions:
cffi: 1.11.5
cherrypy: 3.5.0
dateutil: 2.4.2
gitdb: 0.6.4
gitpython: 1.0.1
Jinja2: 2.8
libgit2: 0.24.0
Mako: 1.0.3
msgpack-python: 0.4.6
pycparser: 2.18
pycrypto: 2.6.1
pygit2: 0.24.0
Python: 2.7.12 (default, Dec 4 2017, 14:50:18)
PyYAML: 3.11
PyZMQ: 15.2.0
smmap: 0.9.0
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.4.0-127-generic
system: Linux
version: Ubuntu 16.04 xenial

@gtmanfred

This comment has been minimized.

Contributor

gtmanfred commented May 25, 2018

@blefeuvr I am unable to replicate this failure.

[root@salt master.d]# salt-run reactor.list 2>/dev/null
event:
    ----------
    _stamp:
        2018-05-25T13:31:36.574246
suffix:
    salt/reactors/manage/list
[root@salt master.d]# salt-run reactor.add 'custom/event/tag' reactors='salt://reactor/slack.sls'
event:
    ----------
    _stamp:
        2018-05-25T13:31:47.463345
    event:
        custom/event/tag
    reactors:
        - salt://reactor/slack.sls
suffix:
    salt/reactors/manage/add
[root@salt master.d]# salt-run reactor.delete 'custom/event/tag'
event:
    ----------
    _stamp:
        2018-05-25T13:31:54.715898
    event:
        custom/event/tag
suffix:
    salt/reactors/manage/delete

Do you have reactors configured on your salt master already or not?

@garethgreenaway if you could give us some feedback into what this should look like, that would be greatly appreciated.

Thanks!
Daniel

@gtmanfred gtmanfred added this to the Blocked milestone May 25, 2018

@blefeuvr

This comment has been minimized.

blefeuvr commented May 25, 2018

Both has been tested, with no 'reactor:' entry in config, I have the python exception
And if I add some, I still have the issue.

Tested with this:
In /etc/salt/master:

reactor:
  - 'my/custom/event/tag':
    - salt://reactor/slack.sls

In salt://reactor/slack.sls

notify slack:
  local.slack_notify.post_message
    - tgt: VM-TON
    - kwarg:
        channel: "main"
        api_key: <private_key>
        message: "test"
@garethgreenaway

This comment has been minimized.

Member

garethgreenaway commented May 25, 2018

@gtmanfred will take a look.

@garethgreenaway garethgreenaway self-assigned this May 25, 2018

@garethgreenaway

This comment has been minimized.

Member

garethgreenaway commented May 25, 2018

So the issue is that the reactor runner uses the underlying reactor system. In previous versions, the reactor system was loaded up automatically by the Salt master. In 2017.7 the reactor system was changed to run inside a Salt engine, which is only loaded if reactor is included in the engine configuration for the Salt master or if reactors are defined in the master configuration. If you go the engine configuration route then everything should function as expected.

@blefeuvr

This comment has been minimized.

blefeuvr commented May 28, 2018

Indeed, after adding reactor in config an restarted salt-master, it works.
Thanks

@blefeuvr blefeuvr closed this May 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment