From e5e9d42aaa839c5eddb2a79e2d7a9d84e3f65d0f Mon Sep 17 00:00:00 2001 From: Jvst Me Date: Wed, 12 Aug 2026 23:00:23 +0200 Subject: [PATCH] Simplify certbot error messages Switch to shorter single-line errors, suitable for potential run termination reason messages. Before: ```shell $ dstack apply -y Error obtaining test.example.com TLS certificate: Saving debug log to /var/log/letsencrypt/letsencrypt.log Some challenges have failed. Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details. ``` After: ```shell $ dstack apply -y Error obtaining test.example.com TLS certificate: Some challenges have failed. ``` --- src/dstack/_internal/proxy/gateway/services/nginx.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dstack/_internal/proxy/gateway/services/nginx.py b/src/dstack/_internal/proxy/gateway/services/nginx.py index ca3700825..60fcc49f7 100644 --- a/src/dstack/_internal/proxy/gateway/services/nginx.py +++ b/src/dstack/_internal/proxy/gateway/services/nginx.py @@ -262,7 +262,7 @@ def run_certbot(cls, domain: str, acme: ACMESettings) -> None: cmd = ["sudo", "timeout", "--kill-after", str(CERTBOT_2ND_TIMEOUT), str(CERTBOT_TIMEOUT)] cmd += ["certbot", "certonly"] - cmd += ["--non-interactive", "--agree-tos", "--register-unsafely-without-email"] + cmd += ["--non-interactive", "--agree-tos", "--register-unsafely-without-email", "--quiet"] cmd += ["--keep", "--nginx", "--domain", domain] if acme.server: @@ -283,7 +283,13 @@ def run_certbot(cls, domain: str, acme: ACMESettings) -> None: " Make sure DNS records are configured for this gateway." ) if r.returncode != 0: - raise ProxyError(f"Error obtaining {domain} TLS certificate:\n{r.stderr.decode()}") + msg = ( + r.stderr.decode() + .lstrip("An unexpected error occurred:\n") + .strip() + .replace("\n", " ") + ) + raise ProxyError(f"Error obtaining {domain} TLS certificate: {msg}") @staticmethod def certificate_exists(domain: str) -> bool: