From patchwork Sat Dec 21 17:04:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 35115 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 05D7A27BBEA; Sat, 21 Dec 2024 17:06:42 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0214E27BBE2 for ; Sat, 21 Dec 2024 17:06:41 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tP2ve-0005TW-Dq; Sat, 21 Dec 2024 12:06:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tP2vY-0005RS-OO for guix-patches@gnu.org; Sat, 21 Dec 2024 12:06:08 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tP2vV-0003PS-JJ; Sat, 21 Dec 2024 12:06:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=wA07eaLkQ4B3lVWMM51rM1bssBd0q3oVs5rlUk0PLOY=; b=auqc52R01g+8VRmKhXsG/aRz+7MLauM/J00CTppFRgxBHgdqLK3SkfCXj+w94dmmjUvsrLn9R1f9gvIGpIX0ZCq65Ztd9laL9w+lqCsMr6TafrzyNaUxrKQsL7IERSdBT/h3+JFHyR8wo+Uixmc3/gQGZZFzpYDvo98Iunu/u2Y42Yr6AdBlEk2Tjhp+prtDwOm8H2yKX6EUZlNb2MHO+TApgC/5sPEf4R+M5Br2VYnvgwFjoXNimQQ1TrMBLcutPwTfPpo9FbLyQ57ra3F8ACJTcq1y6OcQeop5bCXTz89zt7Ycb3E6Zn8Aop01d+/yioLEkZDXwzSA/Va6HHxzmQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tP2vU-0005RW-SI; Sat, 21 Dec 2024 12:06:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75010] [PATCH 5/7] gnu: machine: Remove &deploy-error. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 21 Dec 2024 17:06:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75010 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75010@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 75010-submit@debbugs.gnu.org id=B75010.173480071620808 (code B ref 75010); Sat, 21 Dec 2024 17:06:04 +0000 Received: (at 75010) by debbugs.gnu.org; 21 Dec 2024 17:05:16 +0000 Received: from localhost ([127.0.0.1]:47523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tP2uh-0005PR-OI for submit@debbugs.gnu.org; Sat, 21 Dec 2024 12:05:16 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:38121 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tP2uc-0005I2-4r for 75010@debbugs.gnu.org; Sat, 21 Dec 2024 12:05:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1734800700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GILwmmbUV5cxDgm2vE7mgAMn6SS5HAWz45VRyyCkjIU=; b=mnd73a6TS7e1pqVgvtQRNtFq38wE5BhUm/Yj2HEIdgAhHXOtqmtIzGY7PNFq5DL8+rMyeR 0usEneEv0XZ3ZB+qf/FIpQAiDPVA3Qg76vfkJ57J9RWHqWq0PDL8rO3G2QyGN9zTF/os+/ RwYUYLaM7DDfG9ot/eLDen2tiVEfPoUOhol/eviW2BAMKHQ8vFKkQUrVvw3d/WbWQZL1qX 0Vuo8OIUm26UoH+Yk4bWxm/gK2AomNfqkhwPin2zUtazj2NSbpHUaH9cnpn/6iFmHN2jBW 8WKSeJ9fWT4P4Y/6cdl4C+WnGJG//QZxdQzGJtBYsE+QqE3DnX84lkD2ZJz6bA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 75f982c0 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <75010@debbugs.gnu.org>; Sat, 21 Dec 2024 17:05:00 +0000 (UTC) Date: Sat, 21 Dec 2024 18:04:09 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches X-Patchwork-Original-From: Herman Rimm via Guix-patches via From: Herman Rimm Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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))) - - -;;; -;;; 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)))))))) ;;; 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~%")