From 4e056d315dcdb84efe02fb80a3bde8dc5249f5c8 Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Thu, 16 Jul 2020 16:41:53 -0700 Subject: [PATCH 1/8] Forcing delete to happen before create --- octodns/provider/azuredns.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 3d8122a..3909ca4 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -497,6 +497,10 @@ 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 Update() -> Delete() -> Create() + # This will help avoid problems in updating a CNAME record into an A record. + changes.reverse() + for change in changes: class_name = change.__class__.__name__ getattr(self, '_apply_{}'.format(class_name))(change) From b67dac5a55c8bdf98bfc8565c1a424f9b067524e Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Thu, 16 Jul 2020 16:46:44 -0700 Subject: [PATCH 2/8] Reducing comment line length --- octodns/provider/azuredns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 3909ca4..7259bfe 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -498,7 +498,7 @@ class AzureProvider(BaseProvider): self._check_zone(azure_zone_name, create=True) # Force the operation order to be Update() -> Delete() -> Create() - # This will help avoid problems in updating a CNAME record into an A record. + # Helps avoid problems in updating a CNAME record into an A record. changes.reverse() for change in changes: From 9b619c5ef21b3aad2576f44abc077961ff4a9f5b Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Thu, 16 Jul 2020 17:07:33 -0700 Subject: [PATCH 3/8] Update comment --- octodns/provider/azuredns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 7259bfe..6fcf015 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -497,7 +497,7 @@ 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 Update() -> Delete() -> Create() + # Force the operation order to be Delete() before Create() # Helps avoid problems in updating a CNAME record into an A record. changes.reverse() From 949a136f533f1ca4642edbc076a3c5fcf4599329 Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Fri, 25 Dec 2020 21:07:23 -0800 Subject: [PATCH 4/8] Enforcing Delete to happen before all other operations in _apply --- octodns/provider/azuredns.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 8ad6dd9..f36c25e 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -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) From d28d51290b011418b240dbcba60f69616dee5f5d Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Fri, 25 Dec 2020 21:11:02 -0800 Subject: [PATCH 5/8] Removing space from blank line --- octodns/provider/azuredns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index f36c25e..3bbe1ea 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -495,7 +495,7 @@ class AzureProvider(BaseProvider): class_name = change.__class__.__name__ if class_name == 'Delete': getattr(self, '_apply_{}'.format(class_name))(change) - + for change in changes: class_name = change.__class__.__name__ if class_name != 'Delete': From cad48ea4e8371fb1a7f1303495d7c59a888c0fdb Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Fri, 25 Dec 2020 21:50:46 -0800 Subject: [PATCH 6/8] Updating lengthy comment --- octodns/provider/azuredns.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 3bbe1ea..a86d671 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -488,8 +488,12 @@ 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 all other operations. - # Helps avoid problems in updating a CNAME record into an A record and vice-versa. + ''' + Force the operation order to be Delete() before all other operations. + Helps avoid problems in updating + - a CNAME record into an A record. + - an A record into a CNAME record. + ''' for change in changes: class_name = change.__class__.__name__ From cffc90607161fb1785aac5311414c3ce49c9904b Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Fri, 25 Dec 2020 21:53:47 -0800 Subject: [PATCH 7/8] Removing trailing whitespace in comment --- octodns/provider/azuredns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index a86d671..4be0d4d 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -490,7 +490,7 @@ class AzureProvider(BaseProvider): ''' Force the operation order to be Delete() before all other operations. - Helps avoid problems in updating + Helps avoid problems in updating - a CNAME record into an A record. - an A record into a CNAME record. ''' From 32811ed5c1906aa93afa0c83307811febfa0b531 Mon Sep 17 00:00:00 2001 From: Arunothia Marappan Date: Sat, 26 Dec 2020 15:01:14 -0800 Subject: [PATCH 8/8] Update octodns/provider/azuredns.py Co-authored-by: Ross McFarland --- octodns/provider/azuredns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octodns/provider/azuredns.py b/octodns/provider/azuredns.py index 4be0d4d..d1ec333 100644 --- a/octodns/provider/azuredns.py +++ b/octodns/provider/azuredns.py @@ -498,7 +498,7 @@ class AzureProvider(BaseProvider): for change in changes: class_name = change.__class__.__name__ if class_name == 'Delete': - getattr(self, '_apply_{}'.format(class_name))(change) + self._apply_Delete(change) for change in changes: class_name = change.__class__.__name__