mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #13632: Avoid raising exception when checking if FHRP group IP address is primary
This commit is contained in:
parent
272d2c54d4
commit
06f2c6f867
@ -892,7 +892,7 @@ class IPAddress(PrimaryModel):
|
|||||||
def is_oob_ip(self):
|
def is_oob_ip(self):
|
||||||
if self.assigned_object:
|
if self.assigned_object:
|
||||||
parent = getattr(self.assigned_object, 'parent_object', None)
|
parent = getattr(self.assigned_object, 'parent_object', None)
|
||||||
if hasattr(parent, "oob_ip_id") and parent.oob_ip_id == self.pk:
|
if hasattr(parent, 'oob_ip') and parent.oob_ip_id == self.pk:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -900,9 +900,9 @@ class IPAddress(PrimaryModel):
|
|||||||
def is_primary_ip(self):
|
def is_primary_ip(self):
|
||||||
if self.assigned_object:
|
if self.assigned_object:
|
||||||
parent = getattr(self.assigned_object, 'parent_object', None)
|
parent = getattr(self.assigned_object, 'parent_object', None)
|
||||||
if self.family == 4 and parent.primary_ip4_id == self.pk:
|
if self.family == 4 and hasattr(parent, 'primary_ip4') and parent.primary_ip4_id == self.pk:
|
||||||
return True
|
return True
|
||||||
if self.family == 6 and parent.primary_ip6_id == self.pk:
|
if self.family == 6 and hasattr(parent, 'primary_ip6') and parent.primary_ip6_id == self.pk:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user