Closed
Description
NetBox version
v3.4.5
Python version
3.8
Steps to Reproduce
We encountered this on our local version (3.4.2) but were able to reproduce on the demo instance (3.4.5)
- Browse to the edit page for an ipv4 address marked as primary ip for a device
- Change the device and interface to another device and interface, leave the "Make this the primary IP for the device/VM" box ticked
- Press Save
Expected Behavior
IP address is updated to be set as primary ip for the new device, and assigned to the new interface, and is no longer primary ip address for the old device and is no longer assigned to the old interface.
Observed Behavior
The web server displays:
<class 'django.db.utils.IntegrityError'>
duplicate key value violates unique constraint "dcim_device_primary_ip4_id_key"
DETAIL: Key (primary_ip4_id)=(185) already exists.