autodns dry-run: return a proper datastructure to the api instead of ~humanfriendly string

This commit is contained in:
Alexandre Aubin 2021-09-17 01:15:36 +02:00
parent 7655b7b7c3
commit 71b09ae0e7

View file

@ -726,12 +726,15 @@ def domain_registrar_push(operation_logger, domain, dry_run=False, force=False,
return f'{name:>20} [{t:^5}] {old_content:^30} -> {new_content:^30} {ignored}' return f'{name:>20} [{t:^5}] {old_content:^30} -> {new_content:^30} {ignored}'
if dry_run: if dry_run:
out = {"delete": [], "create": [], "update": []} if Moulinette.interface.type == "api":
for action in ["delete", "create", "update"]: return changes
for record in changes[action]: else:
out[action].append(human_readable_record(action, record)) out = {"delete": [], "create": [], "update": []}
for action in ["delete", "create", "update"]:
for record in changes[action]:
out[action].append(human_readable_record(action, record))
return out return out
operation_logger.start() operation_logger.start()