From ac60516638dc0fdf16cfc571ecc099a89da34797 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Tue, 5 Jul 2022 10:15:56 +0200 Subject: [PATCH] Raise an actual error (instead of log) --- locales/en.json | 1 + src/dns.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/locales/en.json b/locales/en.json index 9ea928b1a..3c56c207b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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}.", diff --git a/src/dns.py b/src/dns.py index 00bb72d42..0a7ce7ea2 100644 --- a/src/dns.py +++ b/src/dns.py @@ -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):