summaryrefslogtreecommitdiff
path: root/gnu/machine.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-08-22 15:53:27 -0400
committerMark H Weaver <mhw@netris.org>2019-08-22 15:53:27 -0400
commit893c2df00daa4e6dd6a7ff3813d7df5329877f9e (patch)
treeacd0db459464acae47083b66d5ce12cc656e2f10 /gnu/machine.scm
parent04b9b7bb05aff4c41f46cd79aa7bc953ace16e86 (diff)
parent0ccc9a0f5bb89b239d56157ea66f8420fcec5ba6 (diff)
downloadguix-patches-893c2df00daa4e6dd6a7ff3813d7df5329877f9e.tar
guix-patches-893c2df00daa4e6dd6a7ff3813d7df5329877f9e.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/machine.scm')
-rw-r--r--gnu/machine.scm27
1 files changed, 26 insertions, 1 deletions
diff --git a/gnu/machine.scm b/gnu/machine.scm
index 30ae97f6ec..05b03b21d4 100644
--- a/gnu/machine.scm
+++ b/gnu/machine.scm
@@ -24,6 +24,7 @@
#:use-module (guix records)
#:use-module (guix store)
#:use-module ((guix utils) #:select (source-properties->location))
+ #:use-module (srfi srfi-35)
#:export (environment-type
environment-type?
environment-type-name
@@ -40,7 +41,13 @@
machine-display-name
deploy-machine
- machine-remote-eval))
+ roll-back-machine
+ machine-remote-eval
+
+ &deploy-error
+ deploy-error?
+ deploy-error-should-roll-back
+ deploy-error-captured-args))
;;; Commentary:
;;;
@@ -66,6 +73,7 @@
;; of the form '(machine-remote-eval machine exp)'.
(machine-remote-eval environment-type-machine-remote-eval) ; procedure
(deploy-machine environment-type-deploy-machine) ; procedure
+ (roll-back-machine environment-type-roll-back-machine) ; procedure
;; Metadata.
(name environment-type-name) ; symbol
@@ -105,3 +113,20 @@ are built and deployed to MACHINE beforehand."
MACHINE, activating it on MACHINE and switching MACHINE to the new generation."
(let ((environment (machine-environment machine)))
((environment-type-deploy-machine environment) machine)))
+
+(define (roll-back-machine machine)
+ "Monadic procedure rolling back to the previous system generation on
+MACHINE. Return the number of the generation that was current before switching
+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))