mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #959 from octodns/get-zone
Manager.get_zone used everywhere rather than direct create
This commit is contained in:
@@ -385,7 +385,7 @@ class Manager(object):
|
||||
lenient=False,
|
||||
):
|
||||
|
||||
zone = Zone(zone_name, sub_zones=self.configured_sub_zones(zone_name))
|
||||
zone = self.get_zone(zone_name)
|
||||
self.log.debug(
|
||||
'sync: populating, zone=%s, lenient=%s',
|
||||
zone.decoded_name,
|
||||
@@ -747,8 +747,7 @@ class Manager(object):
|
||||
clz = SplitYamlProvider
|
||||
target = clz('dump', output_dir)
|
||||
|
||||
# TODO: use get_zone???
|
||||
zone = Zone(zone, self.configured_sub_zones(zone))
|
||||
zone = self.get_zone(zone)
|
||||
for source in sources:
|
||||
source.populate(zone, lenient=lenient)
|
||||
|
||||
@@ -761,7 +760,7 @@ class Manager(object):
|
||||
# TODO: this code can probably be shared with stuff in sync
|
||||
for zone_name, config in self.config['zones'].items():
|
||||
decoded_zone_name = idna_decode(zone_name)
|
||||
zone = Zone(zone_name, self.configured_sub_zones(zone_name))
|
||||
zone = self.get_zone(zone_name)
|
||||
|
||||
source_zone = config.get('alias')
|
||||
if source_zone:
|
||||
@@ -830,9 +829,8 @@ class Manager(object):
|
||||
)
|
||||
|
||||
zone = self.config['zones'].get(zone_name)
|
||||
if zone:
|
||||
return Zone(
|
||||
idna_encode(zone_name), self.configured_sub_zones(zone_name)
|
||||
)
|
||||
if zone is not None:
|
||||
sub_zones = self.configured_sub_zones(zone_name)
|
||||
return Zone(idna_encode(zone_name), sub_zones)
|
||||
|
||||
raise ManagerException(f'Unknown zone name {idna_decode(zone_name)}')
|
||||
|
||||
@@ -379,9 +379,9 @@ class TestManager(TestCase):
|
||||
sources=['in'],
|
||||
)
|
||||
|
||||
# make sure this fails with an IOError and not a KeyError when
|
||||
# trying to find sub zones
|
||||
with self.assertRaises(IOError):
|
||||
# make sure this fails with an ManagerException and not a KeyError
|
||||
# when trying to find sub zones
|
||||
with self.assertRaises(ManagerException):
|
||||
manager.dump(
|
||||
zone='unknown.zone.',
|
||||
output_dir=tmpdir.dirname,
|
||||
@@ -502,9 +502,9 @@ class TestManager(TestCase):
|
||||
sources=['in'],
|
||||
)
|
||||
|
||||
# make sure this fails with an OSError and not a KeyError when
|
||||
# trying to find sub zones
|
||||
with self.assertRaises(OSError):
|
||||
# make sure this fails with an ManagerException and not a KeyError
|
||||
# when trying to find sub zones
|
||||
with self.assertRaises(ManagerException):
|
||||
manager.dump(
|
||||
zone='unknown.zone.',
|
||||
output_dir=tmpdir.dirname,
|
||||
|
||||
Reference in New Issue
Block a user