Skip to content

Commit

Permalink
Update models.py (#2502)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
knobix authored and jeremystretch committed Nov 5, 2018
1 parent e97708a commit 0c86fd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netbox/ipam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,11 @@ def clean(self):
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({
Expand Down

0 comments on commit 0c86fd8

Please sign in to comment.