Cannot edit IP addresses which have a NAT IP that is assigned to a VM without a cluster #7266

Closed
opened 2025-12-29 20:21:00 +01:00 by adam · 0 comments
Owner

Originally created by @barnebyte-timewarp on GitHub (Nov 22, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.8

Python version

3.8

Steps to Reproduce

  1. Assign an IP to an interface of a VM that doesn't have a cluster
    image
    image

  2. Set NAT IP (Inside) of an IP Address to the IP referenced in 1st point
    image

  3. Try to edit the IP address referenced in 2nd point
    image

You get an error:
File "/opt/netbox/netbox/ipam/forms/models.py", line 432, in init
initial['nat_cluster'] = nat_inside_parent.virtual_machine.cluster.pk
AttributeError: 'NoneType' object has no attribute 'pk'

Expected Behavior

The Edit view should be rendered

Observed Behavior

An AttributeError: 'NoneType' object has no attribute 'pk' is raised

Originally created by @barnebyte-timewarp on GitHub (Nov 22, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.8 ### Python version 3.8 ### Steps to Reproduce 1. Assign an IP to an interface of a VM that doesn't have a cluster ![image](https://user-images.githubusercontent.com/110464157/203287116-0316f992-9ca9-4ba0-85f4-0e68368905f9.png) ![image](https://user-images.githubusercontent.com/110464157/203287234-cd7d5b86-4dc6-4be1-8fe3-06fa47bd33da.png) 2. Set NAT IP (Inside) of an IP Address to the IP referenced in 1st point ![image](https://user-images.githubusercontent.com/110464157/203287930-5f97fdc0-d56b-404f-8bd4-42d95f8a9cb4.png) 3. Try to edit the IP address referenced in 2nd point ![image](https://user-images.githubusercontent.com/110464157/203288333-9fad8643-678b-4419-ba77-5e922c9377b7.png) You get an error: File "/opt/netbox/netbox/ipam/forms/models.py", line 432, in __init__ initial['nat_cluster'] = nat_inside_parent.virtual_machine.cluster.pk AttributeError: 'NoneType' object has no attribute 'pk' ### Expected Behavior The Edit view should be rendered ### Observed Behavior An AttributeError: 'NoneType' object has no attribute 'pk' is raised
adam added the type: bugstatus: accepted labels 2025-12-29 20:21:00 +01:00
adam closed this issue 2025-12-29 20:21:01 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7266