diff --git a/octodns/manager.py b/octodns/manager.py index 566b979..40a9c4f 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -315,12 +315,13 @@ class Manager(object): while zones: # Grab the one we'lre going to work on now zone = zones.pop() - trimmer = len(zone) + 1 + dotted = f'.{zone}' + trimmer = len(dotted) subs = set() # look at all the zone names that come after it for candidate in zones: - # If they end with this zone's name them they're a sub - if candidate.endswith(zone): + # If they end with this zone's dotted name, it's a sub + if candidate.endswith(dotted): # We want subs to exclude the zone portion subs.add(candidate[:-trimmer]) diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index e3a5a50..420dfe3 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -776,6 +776,17 @@ class TestManager(TestCase): set(), manager.configured_sub_zones('skipped.alevel.unit2.tests.') ) + # zones that end with names of others + manager.config['zones'] = { + 'unit.tests.': {}, + 'uunit.tests.': {}, + 'uuunit.tests.': {}, + } + manager._configured_sub_zones = None + self.assertEqual(set(), manager.configured_sub_zones('unit.tests.')) + self.assertEqual(set(), manager.configured_sub_zones('uunit.tests.')) + self.assertEqual(set(), manager.configured_sub_zones('uuunit.tests.')) + class TestMainThreadExecutor(TestCase): def test_success(self):