[bug#75414,1/2] machine: ssh: Return monadic value from roll-back-managed-host.

Message ID 9d154b115a6a1bb7a7fb0cc24d1bd8c90a1437ab.1736208948.git.arunisaac@systemreboot.net
State New
Headers
Series Add roll-back action to guix deploy |

Commit Message

Arun Isaac Jan. 7, 2025, 12:28 a.m. UTC
  Previously, <unspecified> would be returned. That was a bug. Monadic
procedures must always return monadic values.

* gnu/machine/ssh.scm (roll-back-managed-host): Return monadic value.

Change-Id: I3db2879dbfbcab5e9d251fa5ed02c8653adbeafb
---
 gnu/machine/ssh.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ludovic Courtès Jan. 19, 2025, 10 p.m. UTC | #1
Howdy Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

> Previously, <unspecified> would be returned. That was a bug. Monadic
> procedures must always return monadic values.
>
> * gnu/machine/ssh.scm (roll-back-managed-host): Return monadic value.
>
> Change-Id: I3db2879dbfbcab5e9d251fa5ed02c8653adbeafb

LGTM!
  

Patch

diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index bc4289ef7d..73d5dc513e 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
 ;;; Copyright © 2020-2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2024 Ricardo <rekado@elephly.net>
+;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -621,8 +622,9 @@  (define (roll-back-managed-host machine)
                                   #: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))))
+    (if (eqv? 'error remote-result)
+        (raise roll-back-failure)
+        (return remote-result))))
 
 
 ;;;