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

Submitting a threshold rule without a target crashes with a KeyError #1650

Closed
lunkwill42 opened this issue Jan 12, 2018 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@lunkwill42
Copy link
Member

In NAV 4.8, when attempting to submit a new threshold rule in the Treshold tool, if the target field is left empty, the page crashes with a KeyError instead of simply reporting an invalid form submission:

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/threshold/views.py" in add_threshold
  56.         if form.is_valid():
File "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in is_valid
  162.         return self.is_bound and not bool(self.errors)
File "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in errors
  154.             self.full_clean()
File "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in full_clean
  353.         self._clean_fields()
File "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in _clean_fields
  371.                     value = getattr(self, 'clean_%s' % name)()
File "/source/python/nav/web/threshold/forms.py" in clean_alert
  100.         validate_expression(alert, self)
File "/source/python/nav/web/threshold/forms.py" in validate_expression
  121.     target = form.cleaned_data['target']

Exception Type: KeyError at /threshold/add
Exception Value: 'target'
@lunkwill42 lunkwill42 added the bug label Jan 12, 2018
@lunkwill42 lunkwill42 added this to the 4.8.4 milestone Jan 12, 2018
@jmbredal jmbredal self-assigned this Jan 22, 2018
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

2 participants