Skip to content
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

AlertEngine crashes when processing filters containing "not equals" matches #1603

Closed
lunkwill42 opened this issue Oct 26, 2017 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@lunkwill42
Copy link
Member

Ridiculously enough, it seems the AlertEngine does not support filters that have "not equals" match expressions in them, and has never done so in its current incarnation (approximately the last 9 years or so).

Adding such a filter to an alert profile may cause the Alert Engine to crash with this traceback logged:

Traceback (most recent call last):
  File "/usr/lib/nav/alertengine.py", line 162, in main
    check_alerts(debug=opttest)
  File "/usr/lib/python2.7/dist-packages/nav/alertengine/base.py", line 63, in check_alerts
    handle_new_alerts(new_alerts)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 394, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/nav/alertengine/base.py", line 186, in handle_new_alerts
    permissions)
  File "/usr/lib/python2.7/dist-packages/nav/alertengine/base.py", line 200, in _check_match_and_permission
    if memoized_check_alert(alert, filtergroupcontents, 'match check'):
  File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 38, in wrapper
    result = func(*args)
  File "/usr/lib/python2.7/dist-packages/nav/alertengine/base.py", line 450, in check_alert_against_filtergroupcontents
    matches = content.filter.check(alert) == content.positive
  File "/usr/lib/python2.7/dist-packages/nav/models/profiles.py", line 852, in check
    expression.get_operator_mapping())
  File "/usr/lib/python2.7/dist-packages/nav/models/profiles.py", line 761, in get_operator_mapping
    return Operator(type=self.operator).get_operator_mapping()
  File "/usr/lib/python2.7/dist-packages/nav/models/profiles.py", line 735, in get_operator_mapping
    return self.OPERATOR_MAPPING[self.type]
KeyError: 5
@lunkwill42 lunkwill42 added the bug label Oct 26, 2017
@lunkwill42 lunkwill42 added this to the 4.7.3 milestone Oct 26, 2017
@lunkwill42 lunkwill42 self-assigned this Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant