1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #5972/094dc6b6 backport][stable-6] cloudflare_dns: Fix setting SRV records with a root level entry (#6097)

cloudflare_dns: Fix setting SRV records with a root level entry (#5972)

* cloudflare_dns: Fix setting SRV records with a root level entry

* cloudflare_dns: Remove the part which deletes the zone from the SRV record name

The cloudflare API accepts the record name + zone name to be sent. Removing that, will guarantee the module to be idempotent even though that line was added ~7 years ago for that specific reason: 7477fe5141

It seems the most logical explanition is that Cloudflare changed their API response somewhere over the last 7 years.

* cloudflare_dns: Update the changelog fragment

(cherry picked from commit 094dc6b69c)

Co-authored-by: Roy Lenferink <lenferinkroy@gmail.com>
This commit is contained in:
patchback[bot] 2023-02-26 14:16:52 +01:00 committed by GitHub
parent bc64c4035e
commit 31eddc0ffe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- "cloudflare_dns - fixed the possiblity of setting a root-level SRV DNS record (https://github.com/ansible-collections/community.general/pull/5972)."
- "cloudflare_dns - fixed the idempotency for SRV DNS records (https://github.com/ansible-collections/community.general/pull/5972)."

View file

@ -694,10 +694,11 @@ class CloudflareAPI(object):
"port": params['port'], "port": params['port'],
"weight": params['weight'], "weight": params['weight'],
"priority": params['priority'], "priority": params['priority'],
"name": params['record'][:-len('.' + params['zone'])], "name": params['record'],
"proto": params['proto'], "proto": params['proto'],
"service": params['service'] "service": params['service']
} }
new_record = {"type": params['type'], "ttl": params['ttl'], 'data': srv_data} new_record = {"type": params['type'], "ttl": params['ttl'], 'data': srv_data}
search_value = str(params['weight']) + '\t' + str(params['port']) + '\t' + params['value'] search_value = str(params['weight']) + '\t' + str(params['port']) + '\t' + params['value']
search_record = params['service'] + '.' + params['proto'] + '.' + params['record'] search_record = params['service'] + '.' + params['proto'] + '.' + params['record']