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