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

Enforcing Delete to happen before all other operations in _apply

This commit is contained in:
Arunothia Marappan
2020-12-25 21:07:23 -08:00
parent e8573a91f4
commit 949a136f53

View File

@@ -488,10 +488,15 @@ class AzureProvider(BaseProvider):
azure_zone_name = desired.name[:len(desired.name) - 1]
self._check_zone(azure_zone_name, create=True)
# Force the operation order to be Delete() before Create()
# Helps avoid problems in updating a CNAME record into an A record.
changes.reverse()
# Force the operation order to be Delete() before all other operations.
# Helps avoid problems in updating a CNAME record into an A record and vice-versa.
for change in changes:
class_name = change.__class__.__name__
getattr(self, '_apply_{}'.format(class_name))(change)
if class_name == 'Delete':
getattr(self, '_apply_{}'.format(class_name))(change)
for change in changes:
class_name = change.__class__.__name__
if class_name != 'Delete':
getattr(self, '_apply_{}'.format(class_name))(change)