Skip to content

Commit 2bd4458

Browse files
authored
cloudflare_dns: rollback validation for SRV records (#10937)
* cloudflare_dns: rollback validation for SRV records * add changelog frag
1 parent 9dedd77 commit 2bd4458

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- 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).

plugins/modules/cloudflare_dns.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def main():
927927
required_if=[
928928
('state', 'present', ['record', 'type', 'value']),
929929
('state', 'absent', ['record']),
930-
('type', 'SRV', ['proto', 'service', 'value']),
930+
('type', 'SRV', ['proto', 'service']),
931931
('type', 'TLSA', ['proto', 'port']),
932932
('type', 'CAA', ['flag', 'tag', 'value']),
933933
],
@@ -940,8 +940,11 @@ def main():
940940
)
941941

942942
if module.params['type'] == 'SRV':
943-
if not module.params['value'] == '':
944-
module.fail_json(msg="For SRV records the params weight, port and value all need to be defined.")
943+
if not ((module.params['weight'] is not None and module.params['port'] is not None
944+
and not (module.params['value'] is None or module.params['value'] == ''))
945+
or (module.params['weight'] is None and module.params['port'] is None
946+
and (module.params['value'] is None or module.params['value'] == ''))):
947+
module.fail_json(msg="For SRV records the params weight, port and value all need to be defined, or not at all.")
945948

946949
if module.params['type'] == 'SSHFP':
947950
if not ((module.params['algorithm'] is not None and module.params['hash_type'] is not None

0 commit comments

Comments
 (0)