Browse Source

subnets before geos, empty lists ok

pull/993/head
Viranch Mehta 3 years ago
parent
commit
3b17eb155d
No known key found for this signature in database GPG Key ID: D83D1392AE9F93B4
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      octodns/record/dynamic.py

+ 4
- 4
octodns/record/dynamic.py View File

@ -220,8 +220,8 @@ class _DynamicMixin(object):
reasons = []
pools_seen = set()
geos_seen = {}
subnets_seen = {}
geos_seen = {}
if not isinstance(rules, (list, tuple)):
reasons.append('rules must be a list')
@ -238,8 +238,8 @@ class _DynamicMixin(object):
reasons.append(f'rule {rule_num} missing pool')
continue
geos = rule.get('geos', [])
subnets = rule.get('subnets', [])
geos = rule.get('geos', [])
if not isinstance(pool, str):
reasons.append(f'rule {rule_num} invalid pool "{pool}"')
@ -255,7 +255,7 @@ class _DynamicMixin(object):
)
pools_seen.add(pool)
if not geos and not subnets:
if not (subnets or geos):
if seen_default:
reasons.append(f'rule {rule_num} duplicate default')
seen_default = True
@ -310,7 +310,7 @@ class _DynamicMixin(object):
geos_seen[geo] = rule_num
if 'subnets' in rules[-1] or 'geos' in rules[-1]:
if rules[-1].get('subnets') or rules[-1].get('geos'):
reasons.append(
'final rule has "subnets" and/or "geos" and is not catchall'
)


Loading…
Cancel
Save