From 7b0a5fb4878e4b4e36f263776c8cb45e7daf78ed Mon Sep 17 00:00:00 2001 From: Alexandre Mulatinho Date: Wed, 14 Aug 2019 07:07:33 -0300 Subject: [PATCH] ipa_dnsrecord.py: ttl is not required to change zones in ipa (#59924) this fixes the error reported on issue #56872, is user not pass the argument module 'record_ttl' it simples removes from json dictionary to make the correct post request. Fixes #56872 Signed-off-by: Alexandre Mulatinho --- lib/ansible/modules/identity/ipa/ipa_dnsrecord.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/identity/ipa/ipa_dnsrecord.py b/lib/ansible/modules/identity/ipa/ipa_dnsrecord.py index 593ea7a3a19..172cf8c52f6 100644 --- a/lib/ansible/modules/identity/ipa/ipa_dnsrecord.py +++ b/lib/ansible/modules/identity/ipa/ipa_dnsrecord.py @@ -57,6 +57,7 @@ options: - Set the TTL for the record. - Applies only when adding a new or changing the value of record_value. version_added: "2.7" + required: false state: description: State to ensure required: false @@ -249,6 +250,10 @@ def ensure(module, client): record_ttl=to_native(record_ttl, nonstring='passthru'), ) + # ttl is not required to change records + if module_dnsrecord['record_ttl'] is None: + module_dnsrecord.pop('record_ttl') + changed = False if state == 'present': if not ipa_dnsrecord: @@ -285,7 +290,7 @@ def main(): record_type=dict(type='str', default='A', choices=record_types), record_value=dict(type='str', required=True), state=dict(type='str', default='present', choices=['present', 'absent']), - record_ttl=dict(type='int'), + record_ttl=dict(type='int', required=False), ) module = AnsibleModule(