-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 crash when deleting a DNS record or when updating a record with solo=true #9649
Conversation
… a record with solo=true On 2025-01-27, Cloudflare removed the 'zone_id' field from the DNS record API responses. This caused a KeyError in the delete_dns_records method, which previously relied on rr['zone_id']. This commit ensures the zone ID is retrieved via _get_zone_id() rather than using the no-longer-provided 'zone_id' field in the record response. Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27
ready_for_review |
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 your contribution! I've added a first comment below.
changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml
Outdated
Show resolved
Hide resolved
…ng-record.yml Co-authored-by: Felix Fontein <[email protected]>
@felixfontein i've accepted your change, thank you for review! |
this fixes issue #9652 |
changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml
Outdated
Show resolved
Hide resolved
@ibot3 would you mind testing this PR? |
…ng-record.yml Co-authored-by: Felix Fontein <[email protected]>
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.
LGTM from the Ansible perspective, cannot vouch for how it behaves for realsies with Cloudflare
Works for me 👍 |
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #9654 🤖 @patchback |
… a record with solo=true (#9649) * cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true On 2025-01-27, Cloudflare removed the 'zone_id' field from the DNS record API responses. This caused a KeyError in the delete_dns_records method, which previously relied on rr['zone_id']. This commit ensures the zone ID is retrieved via _get_zone_id() rather than using the no-longer-provided 'zone_id' field in the record response. Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27 * Add changelog fragment * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 19d0049)
Backport to stable-10: 💚 backport PR created✅ Backport PR branch: Backported as #9655 🤖 @patchback |
… a record with solo=true (#9649) * cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true On 2025-01-27, Cloudflare removed the 'zone_id' field from the DNS record API responses. This caused a KeyError in the delete_dns_records method, which previously relied on rr['zone_id']. This commit ensures the zone ID is retrieved via _get_zone_id() rather than using the no-longer-provided 'zone_id' field in the record response. Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27 * Add changelog fragment * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 19d0049)
@valievkarim thanks for fixing this! |
… deleting a DNS record or when updating a record with solo=true (#9654) cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true (#9649) * cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true On 2025-01-27, Cloudflare removed the 'zone_id' field from the DNS record API responses. This caused a KeyError in the delete_dns_records method, which previously relied on rr['zone_id']. This commit ensures the zone ID is retrieved via _get_zone_id() rather than using the no-longer-provided 'zone_id' field in the record response. Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27 * Add changelog fragment * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 19d0049) Co-authored-by: valievkarim <[email protected]>
…n deleting a DNS record or when updating a record with solo=true (#9655) cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true (#9649) * cloudflare_dns: fix crash when deleting a DNS record or when updating a record with solo=true On 2025-01-27, Cloudflare removed the 'zone_id' field from the DNS record API responses. This caused a KeyError in the delete_dns_records method, which previously relied on rr['zone_id']. This commit ensures the zone ID is retrieved via _get_zone_id() rather than using the no-longer-provided 'zone_id' field in the record response. Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27 * Add changelog fragment * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> * Update changelogs/fragments/9649-cloudflare_dns-fix-crash-when-deleting-record.yml Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 19d0049) Co-authored-by: valievkarim <[email protected]>
SUMMARY
On 2025-01-27, Cloudflare removed the
zone_id
field from the DNS record API responses. This caused aKeyError
in thedelete_dns_records
method, which previously relied onrr['zone_id']
.This commit ensures the zone ID is retrieved via
_get_zone_id()
rather than using the no-longer-providedzone_id
field in the record response.Reference: https://developers.cloudflare.com/dns/changelog/#2025-01-27
ISSUE TYPE
COMPONENT NAME
cloudflare_dns
ADDITIONAL INFORMATION
before fix:
cfdnstest.yaml
after fix: