diff --git a/octodns/provider/ns1.py b/octodns/provider/ns1.py index 749686d..6cea185 100644 --- a/octodns/provider/ns1.py +++ b/octodns/provider/ns1.py @@ -455,6 +455,9 @@ class Ns1Provider(BaseProvider): return data def _parse_dynamic_pool_name(self, pool_name): + if pool_name.startswith('catchall__'): + # Special case for the old-style catchall prefix + return pool_name[10:] try: pool_name, _ = pool_name.rsplit('__', 1) except ValueError: diff --git a/tests/test_octodns_provider_ns1.py b/tests/test_octodns_provider_ns1.py index 575ce32..00b068b 100644 --- a/tests/test_octodns_provider_ns1.py +++ b/tests/test_octodns_provider_ns1.py @@ -1305,7 +1305,7 @@ class TestNs1ProviderDynamic(TestCase): # Test out a small, but realistic setup that covers all the options # We have country and region in the test config filters = provider._get_updated_filter_chain(True, True) - catchall_pool_name = '{}__catchall'.format('iad') + catchall_pool_name = 'iad__catchall' ns1_record = { 'answers': [{ 'answer': ['3.4.5.6'], @@ -1444,6 +1444,16 @@ class TestNs1ProviderDynamic(TestCase): data2 = provider._data_for_A('A', ns1_record) self.assertEquals(data, data2) + # Same answer if we have an old-style catchall name + old_style_catchall_pool_name = 'catchall__iad' + ns1_record['answers'][-2]['region'] = old_style_catchall_pool_name + ns1_record['answers'][-1]['region'] = old_style_catchall_pool_name + ns1_record['regions'][old_style_catchall_pool_name] = \ + ns1_record['regions'][catchall_pool_name] + del ns1_record['regions'][catchall_pool_name] + data3 = provider._data_for_dynamic_A('A', ns1_record) + self.assertEquals(data, data2) + # Oceania test cases # 1. Full list of countries should return 'OC' in geos oc_countries = Ns1Provider._CONTINENT_TO_LIST_OF_COUNTRIES['OC']