From 3a2ce4add502dabbfbe2c0f4e23a03a6012b6cb0 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 09:47:57 +0200 Subject: [PATCH] [PR #10937/2bd44584 backport][stable-11] cloudflare_dns: rollback validation for SRV records (#10938) cloudflare_dns: rollback validation for SRV records (#10937) * cloudflare_dns: rollback validation for SRV records * add changelog frag (cherry picked from commit 2bd44584d3bac200a7fcb9b35544c8c6324b34f0) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/10934-cloudflare-dns-srv-bug.yml | 2 ++ plugins/modules/cloudflare_dns.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/10934-cloudflare-dns-srv-bug.yml diff --git a/changelogs/fragments/10934-cloudflare-dns-srv-bug.yml b/changelogs/fragments/10934-cloudflare-dns-srv-bug.yml new file mode 100644 index 0000000000..eb2b06d2f1 --- /dev/null +++ b/changelogs/fragments/10934-cloudflare-dns-srv-bug.yml @@ -0,0 +1,2 @@ +bugfixes: + - cloudflare_dns - roll back changes to SRV record validation (https://github.com/ansible-collections/community.general/issues/10934, https://github.com/ansible-collections/community.general/pull/10937). diff --git a/plugins/modules/cloudflare_dns.py b/plugins/modules/cloudflare_dns.py index fafca00b50..c8c5d92be2 100644 --- a/plugins/modules/cloudflare_dns.py +++ b/plugins/modules/cloudflare_dns.py @@ -929,7 +929,7 @@ def main(): required_if=[ ('state', 'present', ['record', 'type', 'value']), ('state', 'absent', ['record']), - ('type', 'SRV', ['proto', 'service', 'value']), + ('type', 'SRV', ['proto', 'service']), ('type', 'TLSA', ['proto', 'port']), ('type', 'CAA', ['flag', 'tag', 'value']), ], @@ -942,8 +942,11 @@ def main(): ) if module.params['type'] == 'SRV': - if not module.params['value'] == '': - module.fail_json(msg="For SRV records the params weight, port and value all need to be defined.") + if not ((module.params['weight'] is not None and module.params['port'] is not None + and not (module.params['value'] is None or module.params['value'] == '')) + or (module.params['weight'] is None and module.params['port'] is None + and (module.params['value'] is None or module.params['value'] == ''))): + module.fail_json(msg="For SRV records the params weight, port and value all need to be defined, or not at all.") if module.params['type'] == 'SSHFP': if not ((module.params['algorithm'] is not None and module.params['hash_type'] is not None