Subject: [PATCH v4 08/11] Give a separate name to a commonly used expression.

From: Lilah Tascheter <[email-masked]>
Date: Thu, 19 Sep 2024 23:16:02 -0500

From: Felix Lechner <[email-masked]>

* gnu/machine/ssh.scm (roll-back-managed-host): Factor out a
  subexpression into new variable parameters.

Change-Id: I8d70684142bea736042d6c9dc8276ea7bdb9c181
---
 gnu/machine/ssh.scm | 47 +++++++++++++++++++++------------------------
 1 file changed, 22 insertions(+), 25 deletions(-)

diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index a96ca68f47..37806a2e1b 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -580,31 +580,28 @@ (define (roll-back-managed-host machine)
   (define roll-back-failure
     (condition (&message (message (G_ "could not roll-back machine")))))
 
-  (mlet* %store-monad ((boot-alternatives (machine->boot-alternatives machine))
-                       (_ -> (if (< (length boot-alternatives) 2)
-                                 (raise roll-back-failure)))
-                       (entries -> (map boot-parameters->menu-entry
-                                        (list (second boot-alternatives))))
-                       (locale -> (boot-parameters-locale
-                                   (second boot-alternatives)))
-                       (crypto-dev -> (boot-parameters-store-crypto-devices
-                                       (second boot-alternatives)))
-                       (store-dir -> (boot-parameters-store-directory-prefix
-                                      (second boot-alternatives)))
-                       (old-entries -> (map boot-parameters->menu-entry
-                                            (drop boot-alternatives 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)))
+  (mlet* %store-monad
+         ((boot-alternatives (machine->boot-alternatives machine))
+          (_ -> (if (< (length boot-alternatives) 2) (raise roll-back-failure)))
+          (parameters (second boot-alternatives))
+          (entries -> (list (boot-parameters->menu-entry parameters)))
+          (locale -> (boot-parameters-locale parameters))
+          (crypto-dev -> (boot-parameters-store-crypto-devices parameters))
+          (store-dir -> (boot-parameters-store-directory-prefix parameters))
+          (old-entries -> (map boot-parameters->menu-entry
+                               (drop boot-alternatives 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))))
 
-- 
2.45.2