diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org> | 2019-08-09 14:24:57 -0400 |
|---|---|---|
| committer | Christopher Lemmer Webber <cwebber@dustycloud.org> | 2019-08-14 15:38:09 -0400 |
| commit | 2c8e04f13670c8c7ad8c7195c305960dd1905363 (patch) | |
| tree | 3a019a797bd022b6907019512e44bf55602d7f1f /gnu/machine/ssh.scm | |
| parent | 67dac6b8920755cb011047157bb7b4fae4760143 (diff) | |
remote: Build derivations appropriate for the remote's
* gnu/machine/ssh.scm (machine-ssh-configuration): Add 'system' field.
(managed-host-remote-eval): Pass 'system' field to 'remote-eval'.
(machine-check-building-for-appropriate-system): New variable.
(check-deployment-sanity): Add call to
'machine-check-building-for-appropriate-system'.
* doc/guix.texi (Invoking guix deploy): Describe new 'system' field.
* guix/ssh.scm (remote-system): New variable.
* guix/remote.scm (remote-eval): Use result of 'remote-system' when
lowering the G-Expression.
(remote-eval): Add 'system' keyword argument.
(trampoline): Return a <program-file> rather than a <scheme-file>.
Diffstat (limited to 'gnu/machine/ssh.scm')
| -rw-r--r-- | gnu/machine/ssh.scm | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index ba3e33c9222..670990a6330 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #:use-module (ice-9 match) | 36 | #:use-module (ice-9 match) |
| 37 | #:use-module (srfi srfi-19) | 37 | #:use-module (srfi srfi-19) |
| 38 | #:use-module (srfi srfi-26) | 38 | #:use-module (srfi srfi-26) |
| 39 | #:use-module (srfi srfi-34) | ||
| 39 | #:use-module (srfi srfi-35) | 40 | #:use-module (srfi srfi-35) |
| 40 | #:export (managed-host-environment-type | 41 | #:export (managed-host-environment-type |
| 41 | 42 | ||
| @@ -68,6 +69,7 @@ | |||
| 68 | machine-ssh-configuration? | 69 | machine-ssh-configuration? |
| 69 | this-machine-ssh-configuration | 70 | this-machine-ssh-configuration |
| 70 | (host-name machine-ssh-configuration-host-name) ; string | 71 | (host-name machine-ssh-configuration-host-name) ; string |
| 72 | (system machine-ssh-configuration-system) ; string | ||
| 71 | (build-locally? machine-ssh-configuration-build-locally? | 73 | (build-locally? machine-ssh-configuration-build-locally? |
| 72 | (default #t)) | 74 | (default #t)) |
| 73 | (port machine-ssh-configuration-port ; integer | 75 | (port machine-ssh-configuration-port ; integer |
| @@ -103,10 +105,12 @@ one from the configuration's parameters if one was not provided." | |||
| 103 | "Internal implementation of 'machine-remote-eval' for MACHINE instances with | 105 | "Internal implementation of 'machine-remote-eval' for MACHINE instances with |
| 104 | an environment type of 'managed-host." | 106 | an environment type of 'managed-host." |
| 105 | (maybe-raise-unsupported-configuration-error machine) | 107 | (maybe-raise-unsupported-configuration-error machine) |
| 106 | (remote-eval exp (machine-ssh-session machine) | 108 | (let ((config (machine-configuration machine))) |
| 107 | #:build-locally? | 109 | (remote-eval exp (machine-ssh-session machine) |
| 108 | (machine-ssh-configuration-build-locally? | 110 | #:build-locally? |
| 109 | (machine-configuration machine)))) | 111 | (machine-ssh-configuration-build-locally? config) |
| 112 | #:system | ||
| 113 | (machine-ssh-configuration-system config)))) | ||
| 110 | 114 | ||
| 111 | 115 | ||
| 112 | ;;; | 116 | ;;; |
| @@ -240,10 +244,29 @@ MACHINE's 'system' declaration do not exist on the machine." | |||
| 240 | device) | 244 | device) |
| 241 | (return #t))) | 245 | (return #t))) |
| 242 | 246 | ||
| 247 | (define (machine-check-building-for-appropriate-system machine) | ||
| 248 | "Raise a '&message' error condition if MACHINE is configured to be built | ||
| 249 | locally and the 'system' field does not match the '%current-system' reported | ||
| 250 | by MACHINE." | ||
| 251 | (let ((config (machine-configuration machine)) | ||
| 252 | (system (remote-system (machine-ssh-session machine)))) | ||
| 253 | (when (and (machine-ssh-configuration-build-locally? config) | ||
| 254 | (not (string= system (machine-ssh-configuration-system config)))) | ||
| 255 | (raise (condition | ||
| 256 | (&message | ||
| 257 | (message (format #f (G_ "incorrect target system \ | ||
| 258 | ('~a' was given, while the system reports that it is '~a')~%") | ||
| 259 | (machine-ssh-configuration-system config) | ||
| 260 | system))))))) | ||
| 261 | (with-monad %store-monad (return #t))) | ||
| 262 | |||
| 243 | (define (check-deployment-sanity machine) | 263 | (define (check-deployment-sanity machine) |
| 244 | "Raise a '&message' error condition if it is clear that deploying MACHINE's | 264 | "Raise a '&message' error condition if it is clear that deploying MACHINE's |
| 245 | 'system' declaration would fail." | 265 | 'system' declaration would fail." |
| 266 | ;; Order is important here -- an incorrect value for 'system' will cause | ||
| 267 | ;; invocations of 'remote-eval' to fail. | ||
| 246 | (mbegin %store-monad | 268 | (mbegin %store-monad |
| 269 | (machine-check-building-for-appropriate-system machine) | ||
| 247 | (machine-check-file-system-availability machine) | 270 | (machine-check-file-system-availability machine) |
| 248 | (machine-check-initrd-modules machine))) | 271 | (machine-check-initrd-modules machine))) |
| 249 | 272 | ||
