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

500 crash when creating Rack Reservation with invalid units #276

Closed
jathanism opened this issue Apr 9, 2021 · 0 comments · Fixed by #280
Closed

500 crash when creating Rack Reservation with invalid units #276

jathanism opened this issue Apr 9, 2021 · 0 comments · Fixed by #280
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@jathanism
Copy link
Contributor

Environment

  • Python version: all
  • Nautobot version: 1.0.0b1-b3
  • I tested both locally and on demo.nautobot.com

Steps to Reproduce

  1. Have a Rack (e.g. rack1)
  2. Navigate to *Organization > Racks > Reservations > [+]
  3. Populate rack1 as your rack, then invalid value in the Unit field, such as pizza

Expected Behavior

Expecting a 400 error that is captured by the UI and emits invalid value error message for that field

Observed Behavior

Server_Error

Traceback

Internal Server Error: /dcim/rack-reservations/4d2a3872-6b5a-4dcd-bff7-c527fff96d79/edit/
Traceback (most recent call last):
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/jathan/sandbox/src/nautobot/nautobot/core/views/generic.py", line 266, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/jathan/sandbox/src/nautobot/nautobot/utilities/views.py", line 94, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/jathan/sandbox/src/nautobot/nautobot/core/views/generic.py", line 293, in post
    if form.is_valid():
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/forms/forms.py", line 177, in is_valid
    return self.is_bound and not self.errors
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/forms/forms.py", line 172, in errors
    self.full_clean()
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/forms/forms.py", line 374, in full_clean
    self._clean_fields()
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/forms/forms.py", line 392, in _clean_fields
    value = field.clean(value)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/contrib/postgres/forms/array.py", line 31, in clean
    value = super().clean(value)
  File "/Users/jathan/Library/Caches/pypoetry/virtualenvs/nautobot-b2ttWva6-py3.8/lib/python3.8/site-packages/django/forms/fields.py", line 149, in clean
    value = self.to_python(value)
  File "/Users/jathan/sandbox/src/nautobot/nautobot/utilities/forms/widgets.py", line 124, in to_python
    value = ",".join([str(n) for n in parse_numeric_range(value)])
  File "/Users/jathan/sandbox/src/nautobot/nautobot/utilities/forms/utils.py", line 33, in parse_numeric_range
    begin, end = int(begin.strip(), base=base), int(end.strip(), base=base) + 1
ValueError: invalid literal for int() with base 10: 'pizza'
@jathanism jathanism added the type: bug Something isn't working as expected label Apr 9, 2021
@jathanism jathanism added this to the v1.0.0 milestone Apr 9, 2021
@jathanism jathanism self-assigned this Apr 9, 2021
@jathanism jathanism added this to To do in Release v1.0.0 via automation Apr 9, 2021
@jathanism jathanism moved this from To do to In progress in Release v1.0.0 Apr 9, 2021
Release v1.0.0 automation moved this from In progress to Done Apr 21, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants