diff --git a/octodns/manager.py b/octodns/manager.py index addcbe1..0560b43 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -387,7 +387,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, @@ -749,8 +749,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) @@ -763,7 +762,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: @@ -832,9 +831,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)}') diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index abcf9a7..3df325d 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -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,