From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id aBjnLo8FZ2e9AQAAqHPOHw:P1 (envelope-from ) for ; Sat, 21 Dec 2024 18:14:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id aBjnLo8FZ2e9AQAAqHPOHw (envelope-from ) for ; Sat, 21 Dec 2024 19:14:39 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=KUmvcxNS; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=vN1DEqTj; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734804879; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ZTYy1cD46r8aq1jDrZf65hzcr3HDQHHFFvlUl8fXvto=; b=H8O38KUlcNkRbHVoz9taz061I1voEWuW1B/ltWaaJIJsna4HnSaZt2sTIi2/TlK4NunSnz JobIMwUxlk2oHOK3axR4llvF+Ce3dFwdWvKwsJZFji8yn998eRsuEDyXz+oYnEKZEXl0ae vuPZl/dJ6OGP3RZDwh97XDdhhPOoT6tliQettOB/0QdK+k/IP5fn2juXaQ8Wo+6WzcarL4 GmqOtPEFWGzqoRBFzn2sUcO4fk85ko+pq+e5M7Nj83ANVHDzqbmqQPCeCWbJ9Dt/d97r7N HTgh7FRU5JjsJj3hWrE0DoBBBq3FPc1VUKtcibRtYQYbfS5cS7nNWbKd/Pq/cA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=KUmvcxNS; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=vN1DEqTj; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734804879; a=rsa-sha256; cv=none; b=NNsBmusKwuIns2mXpxA0tSUzSYzXq7+C0kAX0vv3cQ6SgsyvXm4IpGyfjCA2TsrHnc3jMJ MXYPRN+8jU0IQO3ffyxhjUiz9ezk+fXPumaTEPlN0qvwhUnPnzkUbsuVPZ5idUH6qCBq2T /4tFkm21zJwvEk799w5PmWLbH+BVenSWObOYgxlmpc0LbOXeBXTr1xvJQzaZVAzIYrZ2Be GhEE1iWnzJFoCCYhbzUOktOkLF1DcJALrDQWh2eAoG6WbhXowvIy5uLUbSRq3dG4LdKAe3 kFJHT0DaygBdgk9RmTlKmjCrSaWcD+pj1jSmO27PsJHVRVO3u0C1z0M43CB+cA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 320DF91A7C for ; Sat, 21 Dec 2024 19:14:39 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tP2vV-0005Qx-3b; Sat, 21 Dec 2024 12:06:05 -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 1tP2vT-0005QR-PO for guix-patches@gnu.org; Sat, 21 Dec 2024 12:06:03 -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 1tP2vT-0003Od-HF for guix-patches@gnu.org; Sat, 21 Dec 2024 12:06:03 -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=r8gc31SeqeNK8QNFZkQtXIF7baF85+feQQZYPYWR5FU=; b=KUmvcxNSNap/2xYv0fozfSNG9XjBY8KNW9k4368L+NbKKqu6BJ3WBorfjT+aOMMP54U6Q7+watdMLZP63H6pKacMc+5wh1WnWseT3fORzi+2c4fmRzBBcQIxprulhp2sciMWx4OesaH0uffIEnutO14c+bcl/VOWFzzEeLZO2qWzuzN2O1UGHc+ohOWlNNq3CJQz/dal4IgOsp3x8YDngh9U+FGIF2k/O+2BsiEbPL5lr6YWsLMIbzy99jb3Hi2dFOjIgDti05TnWJPHEA36BYPfHyhB+1Ix1YrizvNpgHPbu2hsB7nSciHHaYZUx2ErNaq6jPOyjbSr1JtCD/ToOg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tP2vT-0005RA-6Z for guix-patches@gnu.org; Sat, 21 Dec 2024 12:06:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75010] [PATCH 2/7] gnu: machine: ssh: Refactor roll-back-managed-host. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Dec 2024 17:06: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 To: 75010@debbugs.gnu.org Received: via spool by 75010-submit@debbugs.gnu.org id=B75010.173480071520785 (code B ref 75010); Sat, 21 Dec 2024 17:06:03 +0000 Received: (at 75010) by debbugs.gnu.org; 21 Dec 2024 17:05:15 +0000 Received: from localhost ([127.0.0.1]:47517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tP2ug-0005PA-GS for submit@debbugs.gnu.org; Sat, 21 Dec 2024 12:05:14 -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 1tP2uZ-0005I2-CI for 75010@debbugs.gnu.org; Sat, 21 Dec 2024 12:05:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1734800696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZTYy1cD46r8aq1jDrZf65hzcr3HDQHHFFvlUl8fXvto=; b=vN1DEqTjNoBYnNwy4Oay68R+N36O6mMiWxCCAEyBy8oDCHBzkwxyXHuiY/rJ2SnvySClI9 we+t4xgtFQy/U2RTQ05pWOW5AC8SdqUTA8rzqOWB8l4pAt+kWPZq7PF3Qqvn0kSaOHrz56 T/AsVid02uDXy5ibnzhuQqocXsrqIxkUrD2r9Meb+Q4DVPxznqurPbS0h17Kc7K2E8fBfU 4hcpD2RstBLDCgM4MrAduX5MCtr8sXSDYoYiHPbFY+6uep451/PcWrH87WjEp+CNbMfemo 0s3zdGcf4J5Rv7gilaKY5S/lHy8E/WMx/GtOXPxc+hdCrkZ1R7Il8d7V50bYIw== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 7c4c3846 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <75010@debbugs.gnu.org>; Sat, 21 Dec 2024 17:04:56 +0000 (UTC) Date: Sat, 21 Dec 2024 18:04:06 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Herman Rimm via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -3.72 X-Spam-Score: -3.72 X-Migadu-Queue-Id: 320DF91A7C X-TUID: +5E80KsIKBOc * gnu/machine/ssh.scm (roll-back-managed-host): Use let* and mbegin. Change-Id: Ic3d5039ecf01e1e965dce8a696e7dbd625d2b3c5 --- gnu/machine/ssh.scm | 53 ++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 3e10d984e7..24c36a1936 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -2,6 +2,8 @@ ;;; Copyright © 2019 Jakob L. Kreuze ;;; Copyright © 2020-2023 Ludovic Courtès ;;; Copyright © 2024 Ricardo +;;; Copyright © 2024 Felix Lechner +;;; Copyright © 2024 Herman Rimm ;;; ;;; This file is part of GNU Guix. ;;; @@ -589,33 +591,30 @@ (define (roll-back-managed-host machine) (define roll-back-failure (condition (&message (message (G_ "could not roll-back machine"))))) - (mlet* %store-monad ((boot-parameters (machine-boot-parameters machine)) - (_ -> (if (< (length boot-parameters) 2) - (raise roll-back-failure))) - (entries -> (map boot-parameters->menu-entry - (list (second boot-parameters)))) - (locale -> (boot-parameters-locale - (second boot-parameters))) - (crypto-dev -> (boot-parameters-store-crypto-devices - (second boot-parameters))) - (store-dir -> (boot-parameters-store-directory-prefix - (second boot-parameters))) - (old-entries -> (map boot-parameters->menu-entry - (drop boot-parameters 2))) - (bootloader -> (operating-system-bootloader - (machine-operating-system machine))) - (bootcfg (lower-object - ((bootloader-configuration-file-generator - (bootloader-configuration-bootloader - bootloader)) - bootloader entries - #:locale locale - #:store-crypto-devices crypto-dev - #:store-directory-prefix store-dir - #:old-entries old-entries))) - (remote-result (machine-remote-eval machine remote-exp))) - (when (eqv? 'error remote-result) - (raise roll-back-failure)))) + (mmatch %store-monad (machine-boot-parameters machine) + ((_ params rest ...) + (let* ((entries (list (boot-parameters->menu-entry params))) + (locale (boot-parameters-locale params)) + (crypto-dev (boot-parameters-store-crypto-devices params)) + (store-dir (boot-parameters-store-directory-prefix params)) + (old-entries (map boot-parameters->menu-entry rest)) + (bootloader (operating-system-bootloader + (machine-operating-system machine))) + (generate-bootloader-configuration-file + (bootloader-configuration-file-generator + (bootloader-configuration-bootloader bootloader)))) + (mbegin %store-monad + (lower-object (generate-bootloader-configuration-file + bootloader entries + #:locale locale + #:store-crypto-devices crypto-dev + #:store-directory-prefix store-dir + #:old-entries old-entries))) + (mlet %store-monad + ((remote-result (machine-remote-eval machine remote-exp))) + (when (eqv? 'error remote-result) + (raise roll-back-failure))))) + (_ (raise roll-back-failure)))) ;;; -- 2.45.2