From patchwork Fri May 9 06:02:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herman Rimm X-Patchwork-Id: 42470 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 5F77527BC4A; Fri, 9 May 2025 07:04:23 +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=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 5B97327BC49 for ; Fri, 9 May 2025 07:04:21 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uDGq9-0004ci-Fq; Fri, 09 May 2025 02:04:09 -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 1uDGq4-0004bw-Ao 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 1uDGq4-0003A4-1o for guix-patches@gnu.org; Fri, 09 May 2025 02:04:04 -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=8CpqUDf8ZdlC4gJ5DMubcB+Q8rCQz8bC3HBoU4fo3vc=; b=KQm1tsyob1syE63RXZYODRTquDyJY9X7qCLXTAYLhdm/rjcTyUMiFzUerutCfslytJmPmPmcCX+rjbpuu9grYJFjZzELAsE1kdtIwbiUe5yETs0UL/H0Vl71oc6N4L/dR/XL+F+Dp4Q73crQn0RPHPab/WGg39O1AA4JOf4061D/2kciWn4Rr/JyppxXRfkQYgwITu/xudzZB4cu0D/ojqoT+BVIx3anz1upEVpPNyWMGLek7H8wPVGmtOanLbvWPw0aENQ1gf6LV5UMSxrGfnygCuU2zmfXNb5Yy0ZlG5f087FAaIfWMkUcOlP30QEzroFal08MofjVTEKmE5tW1g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uDGq3-0002Zr-T9 for guix-patches@gnu.org; Fri, 09 May 2025 02:04:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#75010] [PATCH v4 4/5] gnu: machine: ssh: Roll-back on failure. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 May 2025 06:04:03 +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.17467706229839 (code B ref 75010); Fri, 09 May 2025 06:04:03 +0000 Received: (at 75010) by debbugs.gnu.org; 9 May 2025 06:03:42 +0000 Received: from localhost ([127.0.0.1]:34617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uDGpi-0002Yd-G5 for submit@debbugs.gnu.org; Fri, 09 May 2025 02:03:42 -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 1uDGpd-0002XQ-NZ for 75010@debbugs.gnu.org; Fri, 09 May 2025 02:03:38 -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=8CpqUDf8ZdlC4gJ5DMubcB+Q8rCQz8bC3HBoU4fo3vc=; b=XyYrt/Nrc/P4LXE2Cd0n1UO1bPeBQEGB6YXvGOI6/D9pY1kJvOVvv0onpabZ7wdQcttc+E z36J7SNSel/fPH+nV3WzC0k4W8NKZqE2mjLILisOAX8kkEkNoASsQb1OCYAC2Ao4rJqxxK EaZ77JOXfJcvxCq9Wyf03WwdELcgptO5kerIBbLg8fq4dhH71YHy1ag6N1pj7aH2jZtR77 G28kWXC15KS2Sin++GOFCcorVA8Rz0dKznYqlz7QIStPVHPf72+li5iW4/2Gf+jYag8eh2 6GFItmzFjZir66EkLO0hs6V5JPgPoHfJPIWplBt9MrNc3YLeBOEVIFfQCgEMhw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 4f7648c3 (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:28 +0200 Message-ID: <4d35b3b044f8a61a4683d12dd71c835fb3d57864.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 This restores the roll-back behaviour which was disabled in 2885c35. * gnu/machine/ssh.scm (deploy-managed-host): Use roll-back-machine. Change-Id: I8636347541ee1e4e30da15dd43455329a46c3bdb --- gnu/machine/ssh.scm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index aea390fe0b3..357b4376d4b 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -513,7 +513,8 @@ (define (deploy-managed-host machine) (menu-entries (map boot-parameters->menu-entry boot-parameters)) (bootloader-configuration (operating-system-bootloader os)) (bootcfg (operating-system-bootcfg os menu-entries))) - (define-syntax-rule (eval/error-handling condition handler ...) + (define-syntax-rule (eval/error-handling condition store + handler ...) ;; Return a wrapper around EVAL such that HANDLER is evaluated if an ;; exception is raised. (lambda (exp) @@ -525,7 +526,7 @@ (define (deploy-managed-host machine) store))))) (mbegin %store-monad - (switch-to-system (eval/error-handling c + (switch-to-system (eval/error-handling c store (raise (formatted-message (G_ "\ failed to switch systems while deploying '~a':~%~{~s ~}") @@ -536,19 +537,28 @@ (define (deploy-managed-host machine) (%current-target-system #f)) (mbegin %store-monad (upgrade-shepherd-services - (eval/error-handling c + (eval/error-handling c store + (info (G_ "rolling back ~a...~%") host) + (run-with-store store (roll-back-machine machine) + #:system system) (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 + (eval/error-handling c store + (info (G_ "rolling back ~a...~%") host) + (run-with-store store (roll-back-machine machine) + #:system system) (warning (G_ "\ failed to load system of '~a' for kexec reboot:~%~{~s~^ ~}~%") host (inferior-exception-arguments c))) os) (install-bootloader - (eval/error-handling c + (eval/error-handling c store + (info (G_ "rolling back ~a...~%") host) + (run-with-store store (roll-back-machine machine) + #:system system) (raise (formatted-message (G_ "\ failed to install bootloader on '~a':~%~{~s ~}~%")