summaryrefslogtreecommitdiff
path: root/gnu/machine.scm
diff options
context:
space:
mode:
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 30ae97f6ecb..05b03b21d49 100644
--- a/gnu/machine.scm
+++ b/gnu/machine.scm
@@ -24,6 +24,7 @@
24 #:use-module (guix records) 24 #:use-module (guix records)
25 #:use-module (guix store) 25 #:use-module (guix store)
26 #:use-module ((guix utils) #:select (source-properties->location)) 26 #:use-module ((guix utils) #:select (source-properties->location))
27 #:use-module (srfi srfi-35)
27 #:export (environment-type 28 #:export (environment-type
28 environment-type? 29 environment-type?
29 environment-type-name 30 environment-type-name
@@ -40,7 +41,13 @@
40 machine-display-name 41 machine-display-name
41 42
42 deploy-machine 43 deploy-machine
43 machine-remote-eval)) 44 roll-back-machine
45 machine-remote-eval
46
47 &deploy-error
48 deploy-error?
49 deploy-error-should-roll-back
50 deploy-error-captured-args))
44 51
45;;; Commentary: 52;;; Commentary:
46;;; 53;;;
@@ -66,6 +73,7 @@
66 ;; of the form '(machine-remote-eval machine exp)'. 73 ;; of the form '(machine-remote-eval machine exp)'.
67 (machine-remote-eval environment-type-machine-remote-eval) ; procedure 74 (machine-remote-eval environment-type-machine-remote-eval) ; procedure
68 (deploy-machine environment-type-deploy-machine) ; procedure 75 (deploy-machine environment-type-deploy-machine) ; procedure
76 (roll-back-machine environment-type-roll-back-machine) ; procedure
69 77
70 ;; Metadata. 78 ;; Metadata.
71 (name environment-type-name) ; symbol 79 (name environment-type-name) ; symbol
@@ -105,3 +113,20 @@ are built and deployed to MACHINE beforehand."
105MACHINE, activating it on MACHINE and switching MACHINE to the new generation." 113MACHINE, activating it on MACHINE and switching MACHINE to the new generation."
106 (let ((environment (machine-environment machine))) 114 (let ((environment (machine-environment machine)))
107 ((environment-type-deploy-machine environment) machine))) 115 ((environment-type-deploy-machine environment) machine)))
116
117(define (roll-back-machine machine)
118 "Monadic procedure rolling back to the previous system generation on
119MACHINE. Return the number of the generation that was current before switching
120and the new generation number."
121 (let ((environment (machine-environment machine)))
122 ((environment-type-roll-back-machine environment) machine)))
123
124
125;;;
126;;; Error types.
127;;;
128
129(define-condition-type &deploy-error &error
130 deploy-error?
131 (should-roll-back deploy-error-should-roll-back)
132 (captured-args deploy-error-captured-args))