Browse Source

Merge pull request #305 from github/cloudflare-delete-alias

Fix deletion of Cloudflare ALIAS reocrds
pull/306/head
Ross McFarland 7 years ago
committed by GitHub
parent
commit
dfcda702e3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      octodns/provider/cloudflare.py

+ 4
- 1
octodns/provider/cloudflare.py View File

@ -524,9 +524,12 @@ class CloudflareProvider(BaseProvider):
def _apply_Delete(self, change): def _apply_Delete(self, change):
existing = change.existing existing = change.existing
existing_name = existing.fqdn[:-1] existing_name = existing.fqdn[:-1]
# Make sure to map ALIAS to CNAME when looking for the target to delete
existing_type = 'CNAME' if existing._type == 'ALIAS' \
else existing._type
for record in self.zone_records(existing.zone): for record in self.zone_records(existing.zone):
if existing_name == record['name'] and \ if existing_name == record['name'] and \
existing._type == record['type']:
existing_type == record['type']:
path = '/zones/{}/dns_records/{}'.format(record['zone_id'], path = '/zones/{}/dns_records/{}'.format(record['zone_id'],
record['id']) record['id'])
self._request('DELETE', path) self._request('DELETE', path)


Loading…
Cancel
Save