delete all record instead of changing
This commit is contained in:
parent
a171f279db
commit
89d4097377
1 changed files with 15 additions and 24 deletions
|
@ -68,34 +68,25 @@ class OvhDnsEnsure:
|
||||||
)
|
)
|
||||||
self._log.debug(result)
|
self._log.debug(result)
|
||||||
elif self.current_state == 'different':
|
elif self.current_state == 'different':
|
||||||
count = 1
|
|
||||||
for record in self.records:
|
for record in self.records:
|
||||||
self._log.debug(
|
if not self.config['dummy']:
|
||||||
"Processing existing record %s of %s...",
|
|
||||||
count,
|
|
||||||
len(self.records)
|
|
||||||
)
|
|
||||||
if count > 1:
|
|
||||||
if not self.config['dummy']:
|
|
||||||
self._log.debug(
|
|
||||||
'Deleting record %s',
|
|
||||||
record
|
|
||||||
)
|
|
||||||
result = self.ovh.delete(f"/domain/zone/{self.config['zone']}/record/{record}")
|
|
||||||
self._log.debug(result)
|
|
||||||
else:
|
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
'Changing record %s',
|
'Deleting record %s',
|
||||||
record
|
record
|
||||||
)
|
)
|
||||||
if not self.config['dummy']:
|
result = self.ovh.delete(f"/domain/zone/{self.config['zone']}/record/{record}")
|
||||||
result = self.ovh.put(f"/domain/zone/{self.config['zone']}/record/{record}",
|
self._log.debug(result)
|
||||||
subDomain = self.config['subdomain'],
|
self._log.debug(
|
||||||
target = self.config['target'],
|
"Creating new record..."
|
||||||
ttl = self.config['ttl'],
|
)
|
||||||
)
|
if not self.config['dummy']:
|
||||||
self._log.debug(result)
|
result = self.ovh.post(f"/domain/zone/{self.config['zone']}/record/",
|
||||||
count += 1
|
subDomain = self.config['subdomain'],
|
||||||
|
fieldType = self.config['type'],
|
||||||
|
target = self.config['target'],
|
||||||
|
ttl = self.config['ttl'],
|
||||||
|
)
|
||||||
|
self._log.debug(result)
|
||||||
|
|
||||||
|
|
||||||
def _get_current_state(self):
|
def _get_current_state(self):
|
||||||
|
|
Loading…
Reference in a new issue