Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

cannot add watcher to multiple instances #6

Closed
fsouza opened this issue Sep 3, 2014 · 0 comments
Closed

cannot add watcher to multiple instances #6

fsouza opened this issue Sep 3, 2014 · 0 comments
Assignees
Labels

Comments

@fsouza
Copy link

fsouza commented Sep 3, 2014

Every watcher creation is a new user, so it's not possible to add a watcher to multiple instances. For instance:

% tsuru hc add-watcher instance1 fss@tsuru.io
ok
% tsuru hc add-watcher instance2 fss@tsuru.io
BOOM

Here is the log from the API:

2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]: Error handling request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]: Traceback (most recent call last):
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 131, in handle_request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     respiter = self.wsgi(environ, resp.start_response)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     return self.wsgi_app(environ, start_response)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     response = self.make_response(self.handle_exception(e))
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     reraise(exc_type, exc_value, tb)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     response = self.full_dispatch_request()
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     rv = self.handle_user_exception(e)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     reraise(exc_type, exc_value, tb)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     rv = self.dispatch_request()
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     return self.view_functions[rule.endpoint](**req.view_args)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/home/application/current/healthcheck/auth.py", line 25, in decorated
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     return fn(*args, **kwargs)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/home/application/current/healthcheck/api.py", line 74, in add_watcher
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     get_manager().add_watcher(name, watcher)
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/home/application/current/healthcheck/backends/__init__.py", line 77, in add_watcher
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     "period": "1-7,00:00-24:00",
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/pyzabbix/__init__.py", line 140, in fn
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     args or kwargs
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:   File "/usr/local/lib/python2.7/dist-packages/pyzabbix/__init__.py", line 117, in do_request
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]:     raise ZabbixAPIException(msg, response_json['error']['code'])
2014-09-03 17:29:13 -0300 [api][49185a6aa9aa]: ZabbixAPIException: ('Error -32602: Invalid params., User with alias "fss@tsuru.io" already exists. while sending {\'params\': {\'passwd\': \'\', \'alias\': u\'fss@tsuru.io\', \'user_medias\': [{\'mediatypeid\': \'1\', \'active\': 0, \'period\': \'1-7,00:00-24:00\', \'severity\': 63, \'sendto\': u\'fss@tsuru.io\'}], \'usrgrps\': [u\'46\']}, \'jsonrpc\': \'2.0\', \'method\': \'user.create\', \'auth\': u\'redacted\', \'id\': 1}', -32602)
@fsouza fsouza added the bug label Sep 3, 2014
@fsouza fsouza self-assigned this Sep 3, 2014
fsouza pushed a commit that referenced this issue Sep 4, 2014
Raising UserNotFoundError when the user doesn't exist. I really expected
pymongo to raise an exception here, but since they don't, I'm falling
back to the plain old if not <thing>: raise ThingNotFoundError.

Related to #6.
fsouza pushed a commit that referenced this issue Sep 4, 2014
Also rejecting to adding a user to a group twice.

Related to #6.
fsouza pushed a commit that referenced this issue Sep 4, 2014
fsouza pushed a commit that referenced this issue Sep 4, 2014
fsouza pushed a commit that referenced this issue Sep 4, 2014
fsouza pushed a commit that referenced this issue Sep 4, 2014
@fsouza fsouza closed this as completed in 83771c1 Sep 4, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant