mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #356 from github/route53-delete-fix-r2
Make sure both set-id and name match when finding rrset
This commit is contained in:
@@ -387,7 +387,8 @@ class _Route53DynamicValue(_Route53Record):
|
|||||||
# ensures we have the right health check id when there's multiple
|
# ensures we have the right health check id when there's multiple
|
||||||
# potential matches)
|
# potential matches)
|
||||||
for existing in existing_rrsets:
|
for existing in existing_rrsets:
|
||||||
if self.identifer == existing.get('SetIdentifier', None):
|
if self.fqdn == existing.get('Name') and \
|
||||||
|
self.identifer == existing.get('SetIdentifier', None):
|
||||||
return {
|
return {
|
||||||
'Action': action,
|
'Action': action,
|
||||||
'ResourceRecordSet': existing,
|
'ResourceRecordSet': existing,
|
||||||
@@ -453,6 +454,7 @@ class _Route53GeoRecord(_Route53Record):
|
|||||||
def mod(self, action, existing_rrsets):
|
def mod(self, action, existing_rrsets):
|
||||||
geo = self.geo
|
geo = self.geo
|
||||||
set_identifier = geo.code
|
set_identifier = geo.code
|
||||||
|
fqdn = self.fqdn
|
||||||
|
|
||||||
if action == 'DELETE':
|
if action == 'DELETE':
|
||||||
# When deleting records try and find the original rrset so that
|
# When deleting records try and find the original rrset so that
|
||||||
@@ -460,7 +462,8 @@ class _Route53GeoRecord(_Route53Record):
|
|||||||
# ensures we have the right health check id when there's multiple
|
# ensures we have the right health check id when there's multiple
|
||||||
# potential matches)
|
# potential matches)
|
||||||
for existing in existing_rrsets:
|
for existing in existing_rrsets:
|
||||||
if set_identifier == existing.get('SetIdentifier', None):
|
if fqdn == existing.get('Name') and \
|
||||||
|
set_identifier == existing.get('SetIdentifier', None):
|
||||||
return {
|
return {
|
||||||
'Action': action,
|
'Action': action,
|
||||||
'ResourceRecordSet': existing,
|
'ResourceRecordSet': existing,
|
||||||
|
|||||||
@@ -2075,9 +2075,15 @@ class TestRoute53Records(TestCase):
|
|||||||
candidates = [
|
candidates = [
|
||||||
# Empty, will test no SetIdentifier
|
# Empty, will test no SetIdentifier
|
||||||
{},
|
{},
|
||||||
|
# Non-matching
|
||||||
{
|
{
|
||||||
'SetIdentifier': 'not-a-match',
|
'SetIdentifier': 'not-a-match',
|
||||||
},
|
},
|
||||||
|
# Same set-id, different name
|
||||||
|
{
|
||||||
|
'Name': 'not-a-match',
|
||||||
|
'SetIdentifier': 'x12346z',
|
||||||
|
},
|
||||||
rrset,
|
rrset,
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2122,6 +2128,11 @@ class TestRoute53Records(TestCase):
|
|||||||
{
|
{
|
||||||
'SetIdentifier': 'not-a-match',
|
'SetIdentifier': 'not-a-match',
|
||||||
},
|
},
|
||||||
|
# Same set-id, different name
|
||||||
|
{
|
||||||
|
'Name': 'not-a-match',
|
||||||
|
'SetIdentifier': 'x12346z',
|
||||||
|
},
|
||||||
rrset,
|
rrset,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user