Adding ip address with incorrect syntax (via Pynetbox) causes web interface error #7550

Closed
opened 2025-12-29 20:25:04 +01:00 by adam · 1 comment
Owner

Originally created by @claremont-awilson on GitHub (Jan 24, 2023).

NetBox version

v3.4.3

Python version

3.10

Steps to Reproduce

I'm not 100% sure this is an issue for this repo, or Pynetbox or netbox-docker to be honest.

When working with Pynetbox I was trying to add an ip address to an existing virtual machine, and used this syntax:

nb.ipam.ip_addresses.create(address="1.2.3.5/24",assigned_object_id=4)

Which is just me fumbling through, when I should have included the assigned_object_type as well i.e.:

nb.ipam.ip_addresses.create(address="1.2.3.5/24",assigned_object_id=4,assigned_object_type="virtualization.vminterface")

Expected Behavior

Error out/not add the IP address as I believe the syntax is incorrect.

Observed Behavior

That added the IP address successfully, and I could perform a .get() and see it. However, the 'IP Addresses' section of the web interface now just generates an error:

image

If I now delete that ip address (e.g.):

nb.ipam.ip_addresses.delete(objects=[8])

That section (i.e. /ipam/ip-addresses/) of the web interface starts working again.

Originally created by @claremont-awilson on GitHub (Jan 24, 2023). ### NetBox version v3.4.3 ### Python version 3.10 ### Steps to Reproduce I'm not 100% sure this is an issue for this repo, or Pynetbox or netbox-docker to be honest. When working with Pynetbox I was trying to add an ip address to an existing virtual machine, and used this syntax: `nb.ipam.ip_addresses.create(address="1.2.3.5/24",assigned_object_id=4)` Which is just me fumbling through, when I should have included the assigned_object_type as well i.e.: `nb.ipam.ip_addresses.create(address="1.2.3.5/24",assigned_object_id=4,assigned_object_type="virtualization.vminterface")` ### Expected Behavior Error out/not add the IP address as I believe the syntax is incorrect. ### Observed Behavior That added the IP address successfully, and I could perform a .get() and see it. However, the 'IP Addresses' section of the web interface now just generates an error: ![image](https://user-images.githubusercontent.com/110598735/214247876-8e28136a-2a12-43e6-b844-5da2c2ab6fcb.png) If I now delete that ip address (e.g.): `nb.ipam.ip_addresses.delete(objects=[8])` That section (i.e. /ipam/ip-addresses/) of the web interface starts working again.
adam added the type: bug label 2025-12-29 20:25:04 +01:00
adam closed this issue 2025-12-29 20:25:04 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 24, 2023):

Thanks for submitting this. Seems like the root issue (failure to validate the assigned object) should be covered by #10221, so I'm going to close this out. Resolving #10221 will result in the first call above triggering a validation error instead of creating the IP address with an incomplete object assignment.

@jeremystretch commented on GitHub (Jan 24, 2023): Thanks for submitting this. Seems like the root issue (failure to validate the assigned object) should be covered by #10221, so I'm going to close this out. Resolving #10221 will result in the first call above triggering a validation error instead of creating the IP address with an incomplete object assignment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7550