-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloudflare_dns: Fix setting SRV records with a root level entry #5972
cloudflare_dns: Fix setting SRV records with a root level entry #5972
Conversation
234aa56
to
cf9e24d
Compare
I just noticed the following related issue: #5167 /cc @felixfontein The suggested solution in that issue is incorrect because that breaks the ability to set SRV records for subdomains. This PR works for me in a idempotent way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. Could you please also update the description for the name
option to mention the special case for SRV
records?
I started adding a note to the In the start of the module a check is done for community.general/plugins/modules/cloudflare_dns.py Lines 411 to 412 in 867aee6
I am willing to add this (if wanted), but I am wondeirng if this 'technical detail' is interesting, since apparently |
2b0a35b
to
d7742ea
Compare
If nobody objects, I'll merge this this weekend. |
…ecord 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: ansible/ansible-modules-extras@7477fe5 It seems the most logical explanition is that Cloudflare changed their API response somewhere over the last 7 years.
This comment was marked as outdated.
This comment was marked as outdated.
If nobody objects, I'll merge this by the end of this weekend. |
Sounds good to me. |
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #6096 🤖 @patchback |
* 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: ansible/ansible-modules-extras@7477fe5 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 094dc6b)
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #6097 🤖 @patchback |
@rlenferink thanks a lot for fixing this! |
* 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: ansible/ansible-modules-extras@7477fe5 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 094dc6b)
…V records with a root level entry (#6096) 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: ansible/ansible-modules-extras@7477fe5 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 094dc6b) Co-authored-by: Roy Lenferink <lenferinkroy@gmail.com>
…V 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: ansible/ansible-modules-extras@7477fe5 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 094dc6b) Co-authored-by: Roy Lenferink <lenferinkroy@gmail.com>
SUMMARY
This fixes a bug in the cloudflare_dns module where setting a root-level SRV record resulted in a
400 Bad Request
. After some debugging apparently the following line removes the zone suffix from the record:community.general/plugins/modules/cloudflare_dns.py
Line 690 in de193ac
Say, input data
params['record'] = example.com
andparams['zone'] = example.com
then name will be empty, which is not accepted by the Cloudflare API. Since the intention was to set a root-level entry, this PR ensures that in that specific casename
will be equals to the zone.ISSUE TYPE
COMPONENT NAME
cloudflare_dns
ADDITIONAL INFORMATION