mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
gandi_livedns: implement diff mode support (#11934)
* feat(gandi_livedns): implement diff mode support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(gandi_livedns): add changelog fragment for PR 11934 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update plugins/modules/gandi_livedns.py Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -20,7 +20,8 @@ attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: none
|
||||
support: full
|
||||
version_added: 13.0.0
|
||||
options:
|
||||
personal_access_token:
|
||||
description:
|
||||
@@ -189,24 +190,32 @@ def main():
|
||||
|
||||
gandi_api = GandiLiveDNSAPI(module)
|
||||
|
||||
domain = module.params["domain"]
|
||||
|
||||
if module.params["state"] == "present":
|
||||
ret, changed = gandi_api.ensure_dns_record(
|
||||
before, ret, changed = gandi_api.ensure_dns_record(
|
||||
module.params["record"],
|
||||
module.params["type"],
|
||||
module.params["ttl"],
|
||||
module.params["values"],
|
||||
module.params["domain"],
|
||||
domain,
|
||||
)
|
||||
else:
|
||||
ret, changed = gandi_api.delete_dns_record(
|
||||
module.params["record"], module.params["type"], module.params["values"], module.params["domain"]
|
||||
before, ret, changed = gandi_api.delete_dns_record(
|
||||
module.params["record"], module.params["type"], module.params["values"], domain
|
||||
)
|
||||
|
||||
result = dict(
|
||||
changed=changed,
|
||||
)
|
||||
if ret:
|
||||
result["record"] = gandi_api.build_result(ret, module.params["domain"])
|
||||
result["record"] = gandi_api.build_result(ret, domain)
|
||||
|
||||
if module._diff:
|
||||
result["diff"] = {
|
||||
"before": gandi_api.build_result(before, domain) or {},
|
||||
"after": result.get("record") or {},
|
||||
}
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user