Update models.py

Fix the handling of shared IPs (VIP, VRRF, etc.) when unique IP space enforcement is set.

Add parentheses for the logical OR-statement to make the evaluation valid.

Fixes: #2501
This commit is contained in:
knobix 2018-10-08 08:44:56 +02:00 committed by GitHub
parent 7d1f6b7049
commit ce4ef7c8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -596,11 +596,11 @@ class IPAddress(ChangeLoggedModel, CustomFieldModel):
if self.address:
# Enforce unique IP space (if applicable)
if self.role not in IPADDRESS_ROLES_NONUNIQUE and (
if self.role not in IPADDRESS_ROLES_NONUNIQUE and ((
self.vrf is None and settings.ENFORCE_GLOBAL_UNIQUE
) or (
self.vrf and self.vrf.enforce_unique
):
)):
duplicate_ips = self.get_duplicates()
if duplicate_ips:
raise ValidationError({