deploy: Gracefully handle errors.

* guix/scripts/deploy.scm (guix-deploy): Wrap body in 'with-error-handling'.
This commit is contained in:
Ludovic Courtès 2020-07-30 11:17:51 +02:00
parent cfd8daaf07
commit c9c8c6331e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 15 additions and 14 deletions

View File

@ -140,18 +140,19 @@ Perform the deployment specified by FILE.\n"))
(define (handle-argument arg result)
(alist-cons 'file arg result))
(let* ((opts (parse-command-line args %options (list %default-options)
#:argument-handler handle-argument))
(file (assq-ref opts 'file))
(machines (or (and file (load-source-file file)) '())))
(show-what-to-deploy machines)
(with-error-handling
(let* ((opts (parse-command-line args %options (list %default-options)
#:argument-handler handle-argument))
(file (assq-ref opts 'file))
(machines (or (and file (load-source-file file)) '())))
(show-what-to-deploy machines)
(with-status-verbosity (assoc-ref opts 'verbosity)
(with-store store
(set-build-options-from-command-line store opts)
(with-build-handler (build-notifier #:use-substitutes?
(assoc-ref opts 'substitutes?))
(parameterize ((%graft? (assq-ref opts 'graft?)))
(map/accumulate-builds store
(cut deploy-machine* store <>)
machines)))))))
(with-status-verbosity (assoc-ref opts 'verbosity)
(with-store store
(set-build-options-from-command-line store opts)
(with-build-handler (build-notifier #:use-substitutes?
(assoc-ref opts 'substitutes?))
(parameterize ((%graft? (assq-ref opts 'graft?)))
(map/accumulate-builds store
(cut deploy-machine* store <>)
machines))))))))