mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 04:12:25 -06:00
Merge branch 'develop-2.10' into 4878-custom-fields
This commit is contained in:
@@ -649,6 +649,7 @@ class IPAddress(ChangeLoggedModel, CustomFieldModel):
|
||||
'reserved': 'info',
|
||||
'deprecated': 'danger',
|
||||
'dhcp': 'success',
|
||||
'slaac': 'success',
|
||||
}
|
||||
|
||||
ROLE_CLASS_MAP = {
|
||||
@@ -725,12 +726,18 @@ 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})"
|
||||
})
|
||||
|
||||
# Validate IP status selection
|
||||
if self.status == IPAddressStatusChoices.STATUS_SLAAC and self.family != 6:
|
||||
raise ValidationError({
|
||||
'status': "Only IPv6 addresses can be assigned SLAAC status"
|
||||
})
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
# Force dns_name to lowercase
|
||||
|
||||
Reference in New Issue
Block a user