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

Error when editing IP #5235

Closed
pboatone opened this issue Oct 12, 2020 · 6 comments
Closed

Error when editing IP #5235

pboatone opened this issue Oct 12, 2020 · 6 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@pboatone
Copy link

pboatone commented Oct 12, 2020

Environment

  • Python version: 3.8.5
  • NetBox version: 2.9.6

Steps to Reproduce

  1. Go to a device
  2. Add an interface "eth0"
    3 Add IP to interface "172.16.3.0/24"
    4 Edit IP -> add a NAT IP(inside) like "192.168.3.0/24"
  3. klick "OK"
  4. Following Error when trying to edit IP:
    2020-10-12 15_07_23-Window
    2020-10-12 15_07_48-Window

Expected Behavior

Expekted is that we want to edit this ip agein.

Observed Behavior

2020-10-12 15_30_38-Window

Originally posted by @pboatone in #5198 (comment)

@jeremystretch
Copy link
Member

This issue is pending closure as it does not conform to one of the provided templates as required by the contributing guide. If you'd like to request that your issue be re-opened, please first update the content so that it matches the appropriate template (this may require rewriting your issue entirely).

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Oct 12, 2020
@pboatone pboatone changed the title Same issue rebuilded today: Error when editing IP Oct 12, 2020
@pboatone
Copy link
Author

Updated post on top

@DanSheps
Copy link
Member

Could you include the backtrace (should have been emailed hopefully if you configured that)?

@szelga
Copy link

szelga commented Oct 22, 2020

not the original poster, but have the same (I reckon) problem.

Environment:


Request Method: GET
Request URL: https://netbox.company.name/ipam/ip-addresses/2384/edit/

Django Version: 3.1
Python Version: 3.7.9
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'django_rq',
 'drf_yasg']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'utilities.middleware.ExceptionHandlingMiddleware',
 'utilities.middleware.RemoteUserMiddleware',
 'utilities.middleware.LoginRequiredMiddleware',
 'utilities.middleware.APIVersionMiddleware',
 'extras.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']



Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 73, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 392, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 123, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 101, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 398, in get
    form = self.model_form(instance=obj, initial=initial_data)
  File "/opt/netbox/netbox/ipam/forms.py", line 623, in __init__
    initial['nat_rack'] = nat_inside_parent.device.rack.pk

Exception Type: AttributeError at /ipam/ip-addresses/165/edit/
Exception Value: 'NoneType' object has no attribute 'pk'

Netbox 2.9.7 from official docker image. the IP in question has NAT, and was created in a previous Netbox version (2.9.4, probably). other IPs do not trigger this error.

@jeremystretch
Copy link
Member

I'm not able to reproduce this behavior on v2.9.7 using the information provided.

@bguinet
Copy link

bguinet commented Nov 5, 2020

I have the same problem

Python version: 3.6.9
NetBox version: 2.9.8

Steps to Reproduce :

  1. Create a device without rack reference, add an interface to this device
  2. Create an IP address "IP_In" referencing the newly created interface as Assignment
  3. Create an IP address "IP_Out" referencing an the IP address "IP_In" as its NAT inside "By IP"
  4. Edit the newly created IP address "IP_Out"

Expected Behavior :
User should be presented with the IP edit form

Observed Behavior :
An AttributeError exception is raised:

Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 73, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 392, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 123, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/venv/lib/python3.6/site-packages/django/views/generic/base.py", line 101, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 398, in get
    form = self.model_form(instance=obj, initial=initial_data)
  File "/opt/netbox/netbox/ipam/forms.py", line 623, in __init__
    initial['nat_rack'] = nat_inside_parent.device.rack.pk
Exception Type: AttributeError at /ipam/ip-addresses/3547/edit/
Exception Value: 'NoneType' object has no attribute 'pk'

I guess it's related to #5022 and to nat_inside_parent.device.rack wich can be None

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application and removed status: revisions needed This issue requires additional information to be actionable labels Nov 16, 2020
@jeremystretch jeremystretch self-assigned this Nov 16, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

5 participants