1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

handle broken alias to ATM for dynamic records

This commit is contained in:
Viranch Mehta
2021-06-09 16:01:18 -07:00
parent f90d261133
commit 5a943f0b13
2 changed files with 28 additions and 2 deletions

View File

@@ -613,8 +613,13 @@ class AzureProvider(BaseProvider):
:type return: dict
'''
if azrecord.cname_record is None and azrecord.target_resource.id:
return self._data_for_dynamic(azrecord)
if azrecord.cname_record is None:
if azrecord.target_resource.id:
return self._data_for_dynamic(azrecord)
else:
# dynamic record alias is broken, return dummy value and apply
# will likely overwrite/fix it
return {'value': 'iam.invalid.'}
return {'value': _check_endswith_dot(azrecord.cname_record.cname)}

View File

@@ -1677,6 +1677,27 @@ class TestAzureDnsProvider(TestCase):
dns_update.assert_not_called()
tm_delete.assert_called_once()
# both are dynamic but alias is broken
provider, existing, record1 = self._get_dynamic_package()
azrecord = RecordSet(
ttl=record1.ttl, target_resource=SubResource(id=None))
azrecord.name = record1.name or '@'
azrecord.type = 'Microsoft.Network/dnszones/{}'.format(record1._type)
record2 = provider._populate_record(zone, azrecord)
self.assertEqual(record2.value, 'iam.invalid.')
change = Update(record2, record1)
provider._apply_Update(change)
tm_sync, dns_update, tm_delete = (
provider._tm_client.profiles.create_or_update,
provider._dns_client.record_sets.create_or_update,
provider._tm_client.profiles.delete
)
tm_sync.assert_not_called()
dns_update.assert_called_once()
tm_delete.assert_not_called()
def test_apply_delete_dynamic(self):
provider, existing, record = self._get_dynamic_package()
provider._populate_traffic_managers()