Browse Source

Use IdnaDict for configured_sub_zones, fix get_zone, comments

pull/922/head
Ross McFarland 3 years ago
parent
commit
497336e6ab
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      octodns/manager.py

+ 7
- 4
octodns/manager.py View File

@ -341,7 +341,7 @@ class Manager(object):
if self._configured_sub_zones is None: if self._configured_sub_zones is None:
# First time through we compute all the sub-zones # First time through we compute all the sub-zones
configured_sub_zones = {}
configured_sub_zones = IdnaDict()
# Get a list of all of our zone names. Sort them from shortest to # Get a list of all of our zone names. Sort them from shortest to
# longest so that parents will always come before their subzones # longest so that parents will always come before their subzones
@ -758,6 +758,7 @@ class Manager(object):
target.apply(plan) target.apply(plan)
def validate_configs(self): def validate_configs(self):
# TODO: this code can probably be shared with stuff in sync
for zone_name, config in self.config['zones'].items(): for zone_name, config in self.config['zones'].items():
zone = Zone(zone_name, self.configured_sub_zones(zone_name)) zone = Zone(zone_name, self.configured_sub_zones(zone_name))
@ -824,8 +825,10 @@ class Manager(object):
f'Invalid zone name {zone_name}, missing ' 'ending dot' f'Invalid zone name {zone_name}, missing ' 'ending dot'
) )
for name, config in self.config['zones'].items():
if name == zone_name:
return Zone(name, self.configured_sub_zones(name))
zone = self.config['zones'].get(zone_name)
if zone:
return Zone(
idna_decode(zone_name), self.configured_sub_zones(zone_name)
)
raise ManagerException(f'Unknown zone name {zone_name}') raise ManagerException(f'Unknown zone name {zone_name}')

Loading…
Cancel
Save