1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #5035: Fix exception when modifying an IP address assigned to a VM

This commit is contained in:
Jeremy Stretch
2020-08-24 10:39:41 -04:00
parent 6e28490b84
commit e7cf87be97
2 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@
### Bug Fixes
* [#5035](https://github.com/netbox-community/netbox/issues/5035) - Fix exception when modifying an IP address assigned to a VM
* [#5038](https://github.com/netbox-community/netbox/issues/5038) - Fix validation of primary IPs assigned to virtual machines
---

View File

@ -745,7 +745,7 @@ class IPAddress(ChangeLoggedModel, CustomFieldModel):
'vminterface': f"IP address is primary for virtual machine {vm} but not assigned to an "
f"interface"
})
elif self.interface.virtual_machine != vm:
elif self.assigned_object.virtual_machine != vm:
raise ValidationError({
'vminterface': f"IP address is primary for virtual machine {vm} but assigned to "
f"{self.assigned_object.virtual_machine} ({self.assigned_object})"