From patchwork Fri May 9 06:02:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 42472 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 E034527BC4B; Fri, 9 May 2025 07:04:41 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS autolearn=ham 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 6357827BC49 for ; Fri, 9 May 2025 07:04:41 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uDGq8-0004cc-R5; Fri, 09 May 2025 02:04:08 -0400 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 1uDGq3-0004bu-Eq for guix-patches@gnu.org; Fri, 09 May 2025 02:04:04 -0400 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 1uDGq3-00039s-5R for guix-patches@gnu.org; Fri, 09 May 2025 02:04:03 -0400 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=WZ5+AW4Qwp38QiV0uDasmznt2IFOQPwL9GcSIcR8LnM=; b=TKGvZju5FGdQTcvZor0AAMdYmTPqU5Lr7XZReocG7q7O7MDAAjC9MqAvnyyvYvesw0djAEhOLx596H3WXKOTReNaOkbBnqru8yDipJHCpi1l5NtLzcUbksZFA688jrkrlN2nMIvaUHscwrAeyn3GC2ieN9YNd56PYxwi+sU2Liao1zoC+5F5hOeVWrBbx5PCfPB2Eney1gYu7LhNHGtqXT3kB+5lWiC83GoqJkatkRhTWp5It9UPYTkzH9IGDxwl+Baj+Zzr4MCmLq72Gy1GYE+lzeYuN0SfWkW45VrjGLmEgNvCuE9DWK5WQOLmbnh0Cx7IdnGUwryW4k9Ig0roMg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uDGq3-0002Zc-0m for guix-patches@gnu.org; Fri, 09 May 2025 02:04:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75010] [PATCH v4 3/5] gnu: machine: Remove &deploy-error. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 May 2025 06:04:02 +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 moreinfo To: 75010@debbugs.gnu.org Received: via spool by 75010-submit@debbugs.gnu.org id=B75010.17467706229825 (code B ref 75010); Fri, 09 May 2025 06:04:02 +0000 Received: (at 75010) by debbugs.gnu.org; 9 May 2025 06:03:42 +0000 Received: from localhost ([127.0.0.1]:34613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uDGph-0002YO-8X for submit@debbugs.gnu.org; Fri, 09 May 2025 02:03:41 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:52169 helo=email.rimm.ee) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uDGpc-0002XQ-NN for 75010@debbugs.gnu.org; Fri, 09 May 2025 02:03:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1746770604; 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=30QiySZrk8Vsw3in5KBxGqsvGL6poSAmwkyZL5AqbSw=; b=j7SBkIOewUSpQ3/aaDybiZEALMGLMAXPJN8FuG0/YwB62XnrmOhUpi/8usogqBktQOMBtD 1JYxYOM/+JNFd75L4d/vCgcxWJ2AtHv454Xwu9JhTYYAYHqqXboSxVaZU8yUzPRtJR6wxz svdLb6Zqp1bZ1SIoiLrWzo2Ojwx+IY7qnUvY9KYL+4E97AR5RcDcG0C47Sd0Aq9ELH2w1l R87kSELI6xaMpEvbojblDegtVtBdQKgHJo3i0wKaGe//70ipPFNGa7yd1ReC3WMu/0KTl7 kHVaXr4L8IWXPEPJ7KCCj95tywbo+s/B1Fu59HupbmNk8SoHc5rACoD2LZWoCA== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 22121843 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <75010@debbugs.gnu.org>; Fri, 9 May 2025 06:03:24 +0000 (UTC) Date: Fri, 9 May 2025 08:02:27 +0200 Message-ID: <863bef6e18135cc897c2a8ddfd2634d696fe41c6.1746769714.git.herman@rimm.ee> X-Mailer: git-send-email 2.47.1 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 | 62 +++++++++++++++-------------------------- guix/scripts/deploy.scm | 8 +----- 3 files changed, 25 insertions(+), 62 deletions(-) diff --git a/gnu/machine.scm b/gnu/machine.scm index 60be6749727..ede595d053d 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 47f379c57e3..aea390fe0b3 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -481,18 +481,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." @@ -537,39 +525,35 @@ (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) - (load-system-for-kexec (eval/error-handling c - (warning (G_ "\ + host (inferior-exception-arguments c))) + os) + (load-system-for-kexec + (eval/error-handling c + (warning (G_ "\ failed to load system of '~a' for kexec reboot:~%~{~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 e2ef0006e06..f80982b6d18 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -181,13 +181,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~%")