Raise an actual error (instead of log)

This commit is contained in:
theo@manjaro 2022-07-05 10:15:56 +02:00
parent dd51adcd3f
commit ac60516638
2 changed files with 5 additions and 0 deletions

View file

@ -324,6 +324,7 @@
"domain_dns_push_already_up_to_date": "Records already up to date, nothing to do.",
"domain_dns_push_failed": "Updating the DNS records failed miserably.",
"domain_dns_push_failed_domain": "Updating the DNS records for {domain} failed : {error}",
"domain_dns_push_failed_domains": "Updating the DNS records for {domains} failed.",
"domain_dns_push_failed_to_authenticate": "Failed to authenticate on registrar's API for domain '{domain}'. Most probably the credentials are incorrect? (Error: {error})",
"domain_dns_push_failed_to_list": "Failed to list current records using the registrar's API: {error}",
"domain_dns_push_managed_in_parent_domain": "The automatic DNS configuration feature is managed in the parent domain {parent_domain}.",

View file

@ -627,11 +627,15 @@ def domain_dns_push(operation_logger, domains, dry_run=False, force=False, purge
# If we provide only a domain as an argument
if isinstance(domains, str):
domains = [domains]
error_domains = []
for domain in domains:
try:
domain_dns_push_unique(domain,dry_run=dry_run,force=force,purge=purge)
except YunohostError as e:
logger.error(m18n.n("domain_dns_push_failed_domain",domain=domain,error=str(e)))
error_domains.append(domain)
if len(error_domains)>0:
raise YunohostError("domain_dns_push_failed_domains",domains=', '.join(error_domains))
@is_unit_operation()
def domain_dns_push_unique(operation_logger, domain, dry_run=False, force=False, purge=False):