add debug

This commit is contained in:
Antonio J. Delgado 2025-05-05 14:51:12 +03:00
parent 00288f10b3
commit cea2b74442

View file

@ -101,12 +101,21 @@ class OvhDnsEnsure:
self.records = self.ovh.get(f"/domain/zone/{self.config['zone']}/record", **params)
self.current_state = 'absent'
for record in self.records:
self._log.debug(
"Checking record: %s...",
record
)
data = self.ovh.get(f"/domain/zone/{self.config['zone']}/record/{record}")
if data['target'] == self.config['target'] and data['ttl'] == self.config['ttl']:
self.current_state = 'same'
self._log.debug('A record with the same type, TTL and target exists. %s', data)
self._log.debug(
'A record with the same type, TTL and target exists. %s',
data
)
if self.current_state == 'absent' and len(self.records) == 0:
self._log.debug("Doesn't exist a record with that type and target")
self._log.debug(
"Doesn't exist a record with that type and target"
)
elif self.current_state == 'absent' and len(self.records) > 0:
self._log.debug(
"There are %s records with same type but different target or TTL",