From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 75010@debbugs.gnu.org
Cc: "Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#75010] [PATCH 5/7] gnu: machine: Remove &deploy-error.
Date: Sat, 21 Dec 2024 18:04:09 +0100 [thread overview]
Message-ID: <bbab03d6042290e23d34e67b054d5a1d8612293f.1734798943.git.herman@rimm.ee> (raw)
In-Reply-To: <cover.1734798943.git.herman@rimm.ee>
* gnu/machine.scm (&deploy-error): Remove.
* gnu/machine/ssh.scm (with-roll-back): Remove.
(deploy-managed-host): Remove with-roll-back.
* guix/scripts/deploy.scm (deploy-machine*): Remove deploy-error? case.
Change-Id: I719eafda0f5d12e1f4e3795631e78378f5376745
---
gnu/machine.scm | 17 +-------------
gnu/machine/ssh.scm | 51 +++++++++++++++--------------------------
guix/scripts/deploy.scm | 8 +------
3 files changed, 20 insertions(+), 56 deletions(-)
diff --git a/gnu/machine.scm b/gnu/machine.scm
index 60be674972..ede595d053 100644
--- a/gnu/machine.scm
+++ b/gnu/machine.scm
@@ -41,12 +41,7 @@ (define-module (gnu machine)
deploy-machine
roll-back-machine
- machine-remote-eval
-
- &deploy-error
- deploy-error?
- deploy-error-should-roll-back
- deploy-error-captured-args))
+ machine-remote-eval))
;;; Commentary:
;;;
@@ -122,13 +117,3 @@ (define (roll-back-machine machine)
and the new generation number."
(let ((environment (machine-environment machine)))
((environment-type-roll-back-machine environment) machine)))
-
-\f
-;;;
-;;; Error types.
-;;;
-
-(define-condition-type &deploy-error &error
- deploy-error?
- (should-roll-back deploy-error-should-roll-back)
- (captured-args deploy-error-captured-args))
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index 3e69d4b9a3..b954620b69 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -480,18 +480,6 @@ (define (machine-boot-parameters machine)
(boot-parameters-kernel-arguments params))))))))
remote-results))))
-(define-syntax-rule (with-roll-back should-roll-back? mbody ...)
- "Catch exceptions that arise when binding MBODY, a monadic expression in
-%STORE-MONAD, and collect their arguments in a &deploy-error condition, with
-the 'should-roll-back' field set to SHOULD-ROLL-BACK?"
- (catch #t
- (lambda ()
- mbody ...)
- (lambda args
- (raise (condition (&deploy-error
- (should-roll-back should-roll-back?)
- (captured-args args)))))))
-
(define (deploy-managed-host machine)
"Internal implementation of 'deploy-machine' for MACHINE instances with an
environment type of 'managed-host."
@@ -536,32 +524,29 @@ (define (deploy-managed-host machine)
store)))))
(mbegin %store-monad
- (with-roll-back #f
- (switch-to-system (eval/error-handling c
- (raise (formatted-message
- (G_ "\
+ (switch-to-system (eval/error-handling c
+ (raise (formatted-message
+ (G_ "\
failed to switch systems while deploying '~a':~%~{~s ~}")
- host
- (inferior-exception-arguments c))))
- os))
+ host
+ (inferior-exception-arguments c))))
+ os)
(parameterize ((%current-system system)
(%current-target-system #f))
- (with-roll-back #t
- (mbegin %store-monad
- (upgrade-shepherd-services (eval/error-handling c
- (warning (G_ "\
+ (mbegin %store-monad
+ (upgrade-shepherd-services
+ (eval/error-handling c
+ (warning (G_ "\
an error occurred while upgrading services on '~a':~%~{~s ~}~%")
- host
- (inferior-exception-arguments
- c)))
- os)
- (install-bootloader (eval/error-handling c
- (raise (formatted-message
- (G_ "\
+ host (inferior-exception-arguments c)))
+ os)
+ (install-bootloader
+ (eval/error-handling c
+ (raise (formatted-message
+ (G_ "\
failed to install bootloader on '~a':~%~{~s ~}~%")
- host
- (inferior-exception-arguments c))))
- bootloader-configuration bootcfg)))))))))
+ host (inferior-exception-arguments c))))
+ bootloader-configuration bootcfg))))))))
\f
;;;
diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index 4b1a603049..ca0e1c4023 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -156,13 +156,7 @@ (define (deploy-machine* store machine)
(apply format #f
(gettext (formatted-message-string c)
%gettext-domain)
- (formatted-message-arguments c))))
- ((deploy-error? c)
- (when (deploy-error-should-roll-back c)
- (info (G_ "rolling back ~a...~%")
- (machine-display-name machine))
- (run-with-store store (roll-back-machine machine)))
- (apply throw (deploy-error-captured-args c))))
+ (formatted-message-arguments c)))))
(run-with-store store (deploy-machine machine))
(info (G_ "successfully deployed ~a~%")
--
2.45.2
next prev parent reply other threads:[~2024-12-21 17:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1734798943.git.herman@rimm.ee>
2024-12-21 17:04 ` [bug#75010] [PATCH 1/7] monads: Add 'mmatch' Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 2/7] gnu: machine: ssh: Refactor roll-back-managed-host Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 3/7] gnu: machine: ssh: Return monadic value from roll-back-managed-host Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 4/7] Rename two remote variables confusingly named 'generations' Herman Rimm via Guix-patches via
2024-12-21 17:04 ` Herman Rimm via Guix-patches via [this message]
2024-12-21 17:04 ` [bug#75010] [PATCH 6/7] gnu: machine: ssh: Roll-back on failure Herman Rimm via Guix-patches via
2024-12-21 17:04 ` [bug#75010] [PATCH 7/7] WIP: gnu: tests: Add module for guix deploy tests Herman Rimm via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bbab03d6042290e23d34e67b054d5a1d8612293f.1734798943.git.herman@rimm.ee \
--to=guix-patches@gnu.org \
--cc=75010@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=herman@rimm.ee \
--cc=ludo@gnu.org \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.