From 24b9477f24f0f01ed58309ebf00388c4e24d62d3 Mon Sep 17 00:00:00 2001 From: Thomas Hintz Date: Mon, 20 Apr 2026 15:44:39 -0700 Subject: [PATCH] Don't allow deploying an app that is being deployed. --- src/nassella.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nassella.scm b/src/nassella.scm index 293f8a4..20b698b 100644 --- a/src/nassella.scm +++ b/src/nassella.scm @@ -1266,10 +1266,14 @@ chmod -R 777 /opt/keys")) ;; TODO run restic-init if needed (like the first run or if the backblaze ;; config changes -;; TODO this can only handle a user deploying one instance at a time! -;; the folder used should be the user-id PLUS the instance id ;; TODO should this perform a backup and then run the systemctl stop app command first? (post "/config/wizard/review-submit/:id" + (let* ((instance-id (alist-ref "id" (current-params) equal?)) + (status (string->symbol + (with-db/transaction + (lambda (db) + (get-most-recent-deployment-status db (session-user-id) instance-id)))))) + (when (not (or (eq? status 'queued) (eq? status 'in-progress))) (let* ((instance-id (alist-ref "id" (current-params) equal?)) (results (with-db/transaction @@ -1403,7 +1407,7 @@ chmod -R 777 /opt/keys")) (with-input-from-file (string-append dir "/make-out") read-string)) (update-user-terraform-state db user-id instance-id (if (eof-object? tf-state) "" tf-state) - (if (eof-object? tf-state-backup) "" tf-state-backup)))))))))))) + (if (eof-object? tf-state-backup) "" tf-state-backup)))))))))))))) (redirect (conc "/config/wizard/success/" (alist-ref "id" (current-params) equal?)))) (get/widgets