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

TypeError when creating IPAddress with prefix of /0 #318

Closed
jathanism opened this issue Apr 14, 2021 · 0 comments · Fixed by #314
Closed

TypeError when creating IPAddress with prefix of /0 #318

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

Comments

@jathanism
Copy link
Contributor

jathanism commented Apr 14, 2021

Environment

  • Python version: 3.6+
  • Nautobot version: beta4 (develop)

Steps to Reproduce

  1. Go to add new IP Address
  2. Fill out IP w/ /0 prefix (e.g. 10.11.12.0/0) + status
  3. Click "Create"

Expected Behavior

Should fail validation as /0 is not permitted for IP addresses.

Observed Behavior

  • Object gets created, but repr isNone as address and causes TypeError to be raised in detail view
  • Form validation seems to be failing for this condition

Traceback

TypeError: unexpected type <class 'NoneType'> for addr arg
  File "django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "nautobot/utilities/views.py", line 94, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "nautobot/core/views/generic.py", line 88, in get
    **self.get_extra_context(request, instance),
  File "nautobot/ipam/views.py", line 588, in get_extra_context
    Prefix.objects.restrict(request.user, "view")
  File "nautobot/ipam/querysets.py", line 61, in net_contains_or_equals
    prefix = netaddr.IPNetwork(prefix)
  File "netaddr/ip/__init__.py", line 942, in __init__
    value, prefixlen = parse_ip_network(module, addr,
  File "netaddr/ip/__init__.py", line 831, in parse_ip_network
    raise TypeError('unexpected type %s for addr arg' % type(addr))
@jathanism jathanism added the type: bug Something isn't working as expected label Apr 14, 2021
@jathanism jathanism added this to the v1.0.0 milestone Apr 14, 2021
@jathanism jathanism added this to To do in Release v1.0.0 via automation Apr 14, 2021
@jathanism jathanism moved this from To do to In progress in Release v1.0.0 Apr 14, 2021
Release v1.0.0 automation moved this from In progress to Done Apr 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 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