Skip to content

Handle unsaved IPAddress objects with a CIDR string in the address field properly#798

Merged
peteeckel merged 3 commits intomainfrom
fix/unsaved-ip-address-slurpit
Mar 12, 2026
Merged

Handle unsaved IPAddress objects with a CIDR string in the address field properly#798
peteeckel merged 3 commits intomainfrom
fix/unsaved-ip-address-slurpit

Conversation

@peteeckel
Copy link
Collaborator

fixes #797

The problem occurs only under very specific conditions, i.e. when the creation of the IPAddress object is done within a script and a CIDR string instead of a netaddr.IPNetwork object is passed to to the address field.

When saving, NetBox converts this field to an netaddr.IPNetwork object behind the scenes. However, as long as the IPAddress object is not refreshed from the database, there is still a string in the address field, which causes the NetBox DNS code to fail in several places.

The safe bet is always to use an IPNetwork object, but this PR should catch the issue even if a CIDR string is used.

@peteeckel peteeckel changed the title Fix/unsaved ip address slurpit Handle unsaved IPAddress objects with a CIDR string in the address field properly Mar 12, 2026
@peteeckel peteeckel merged commit 0ae841a into main Mar 12, 2026
11 checks passed
@peteeckel peteeckel deleted the fix/unsaved-ip-address-slurpit branch March 12, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPAddress objects cannot be created when the address field is a string

1 participant