machine: Use 'become-command'.

* gnu/machine/ssh.scm (managed-host-remote-eval): Pass an appropriate
'become-command' to 'remote-eval'.
* guix/ssh.scm (remote-authorize-signing-key): Add optional
'become-command' argument.
All callers changed.
This commit is contained in:
Jakob L. Kreuze 2019-08-15 12:09:11 -04:00 committed by Christopher Lemmer Webber
parent ddef146b89
commit 4cc5e5204b
No known key found for this signature in database
GPG Key ID: 4BC025925FF8F4D3
2 changed files with 8 additions and 4 deletions

View File

@ -126,7 +126,9 @@ an environment type of 'managed-host."
#:build-locally? #:build-locally?
(machine-ssh-configuration-build-locally? config) (machine-ssh-configuration-build-locally? config)
#:system #:system
(machine-ssh-configuration-system config)))) (machine-ssh-configuration-system config)
#:become-command
(machine-become-command machine))))
;;; ;;;
@ -377,7 +379,8 @@ have you run 'guix archive --generate-key?'")
(lambda (port) (lambda (port)
(string->canonical-sexp (string->canonical-sexp
(get-string-all port)))) (get-string-all port))))
(machine-ssh-session machine))) (machine-ssh-session machine)
(machine-become-command machine)))
(mlet %store-monad ((_ (check-deployment-sanity machine)) (mlet %store-monad ((_ (check-deployment-sanity machine))
(boot-parameters (machine-boot-parameters machine))) (boot-parameters (machine-boot-parameters machine)))
(let* ((os (machine-operating-system machine)) (let* ((os (machine-operating-system machine))

View File

@ -302,7 +302,7 @@ the machine on the other end of SESSION."
(inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system)) (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
session)) session))
(define (remote-authorize-signing-key key session) (define* (remote-authorize-signing-key key session #:optional become-command)
"Send KEY, a canonical sexp containing a public key, over SESSION and add it "Send KEY, a canonical sexp containing a public key, over SESSION and add it
to the system ACL file if it has not yet been authorized." to the system ACL file if it has not yet been authorized."
(inferior-remote-eval (inferior-remote-eval
@ -321,7 +321,8 @@ to the system ACL file if it has not yet been authorized."
(mkdir-p (dirname %acl-file)) (mkdir-p (dirname %acl-file))
(with-atomic-file-output %acl-file (with-atomic-file-output %acl-file
(cut write-acl acl <>))))) (cut write-acl acl <>)))))
session)) session
become-command))
(define* (send-files local files remote (define* (send-files local files remote
#:key #:key