From 321578a74adde5f9d6234d2b18a5bc3fff6f3795 Mon Sep 17 00:00:00 2001 From: Thomas Hintz Date: Wed, 15 Jul 2026 12:19:18 -0700 Subject: [PATCH] Fixing backblaze connection test in prod setups. --- src/nassella.scm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/nassella.scm b/src/nassella.scm index 3581a47..dde6238 100644 --- a/src/nassella.scm +++ b/src/nassella.scm @@ -742,10 +742,10 @@ h1, h2, h3, h4, h5, h6 { "--password-file" "/restic-password" "--json"))) (else - (process* "timeout" - `("--preserve-status" "8s" "restic" "cat" "config" + (process* "/bin/timeout" + `("--preserve-status" "8s" "/bin/restic" "cat" "config" "--repo" ,(conc "s3:" bucket-url) - "--password-file" password-path + "--password-file" ,(conc (current-directory) "/" password-path) "--json") `(("AWS_ACCESS_KEY_ID" . ,key-id) ("AWS_SECRET_ACCESS_KEY" . ,application-key))))) @@ -760,11 +760,14 @@ h1, h2, h3, h4, h5, h6 { (if (= wait-pid 0) ;; wait-pid is 0 until the process has finished (if (< i 12) ;; 12s timeout (loop (+ i 1)) - (error "timeout trying to connect to to backblaze")) + `((success . #f) + (errors ((message . "timeout trying to connect to backblaze"))))) (if exit-normal (let ((res (with-input-from-port in-port read-json)) (err (with-input-from-port err-port read-json))) - (if res + ;; status 10 is what is returned if we can connect but the repo + ;; is not initialized yet + (if (or res (and err (= status 10))) `((success . #t) (result . ,res)) `((success . #f) @@ -774,7 +777,8 @@ h1, h2, h3, h4, h5, h6 { )))))))) (thread-join! thread)))) (lambda () - (delete-file password-path))))) + (handle-exceptions exn 'ignore + (delete-file password-path)))))) (define (deployment-directory user-id instance-id) (string-append "deploy-" (number->string user-id) "-" (->string instance-id)))