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 <alex@mulatinho.net>
This commit is contained in:
Alexandre Mulatinho 2019-08-14 07:07:33 -03:00 committed by Abhijeet Kasurde
parent abf7cf97df
commit 7b0a5fb487

View file

@ -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(