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:
Alexei Znamensky
2026-05-03 12:49:39 +12:00
committed by GitHub
parent d7f248fb01
commit 0ebd32373d
3 changed files with 26 additions and 12 deletions

View File

@@ -168,6 +168,7 @@ class GandiLiveDNSAPI:
if records:
cur_record = records[0]
before = cur_record
self.changed = True
@@ -177,14 +178,14 @@ class GandiLiveDNSAPI:
# Removing one or more values from a record, we update the record with the remaining values
self.update_record(record, type, list(new_values), cur_record["rrset_ttl"], domain)
records = self.get_records(record, type, domain)
return records[0], self.changed
return before, records[0], self.changed
if not self.module.check_mode:
self.delete_record(record, type, domain)
else:
cur_record = None
before = None
return None, self.changed
return before, None, self.changed
def ensure_dns_record(self, record, type, ttl, values, domain):
if record == "":
@@ -194,6 +195,7 @@ class GandiLiveDNSAPI:
if records:
cur_record = records[0]
before = cur_record
do_update = False
if ttl is not None and cur_record["rrset_ttl"] != ttl:
@@ -210,10 +212,11 @@ class GandiLiveDNSAPI:
records = self.get_records(record, type, domain)
result = records[0]
self.changed = True
return result, self.changed
return before, result, self.changed
else:
return cur_record, self.changed
return before, cur_record, self.changed
before = None
if self.module.check_mode:
new_record = dict(rrset_type=type, rrset_name=record, rrset_values=values, rrset_ttl=ttl)
result = new_record
@@ -221,4 +224,4 @@ class GandiLiveDNSAPI:
result = self.create_record(record, type, values, ttl, domain)
self.changed = True
return result, self.changed
return before, result, self.changed