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

View file

@ -140,18 +140,19 @@ (define (guix-deploy . args)
(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))))))))