[PATCH] machine: Use 'become-command'.

  • Done
  • quality assurance status badge
Details
2 participants
  • Christopher Lemmer Webber
  • Jakob L. Kreuze
Owner
unassigned
Submitted by
Jakob L. Kreuze
Severity
normal
J
J
Jakob L. Kreuze wrote on 15 Aug 2019 18:09
(address . guix-patches@gnu.org)
87o90qe7h4.fsf@sdf.lonestar.org
* 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.
---
gnu/machine/ssh.scm | 7 +++++--
guix/ssh.scm | 5 +++--
2 files changed, 8 insertions(+), 4 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index ac3aa3e370..aafe0ccf41 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -126,7 +126,9 @@ an environment type of 'managed-host."
#:build-locally?
(machine-ssh-configuration-build-locally? config)
#: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)
(string->canonical-sexp
(get-string-all port))))
- (machine-ssh-session machine)))
+ (machine-ssh-session machine)
+ (machine-become-command machine)))
(mlet %store-monad ((_ (check-deployment-sanity machine))
(boot-parameters (machine-boot-parameters machine)))
(let* ((os (machine-operating-system machine))
diff --git a/guix/ssh.scm b/guix/ssh.scm
index 24834c6f68..7bc499a2fe 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -302,7 +302,7 @@ the machine on the other end of SESSION."
(inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
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
to the system ACL file if it has not yet been authorized."
(inferior-remote-eval
@@ -321,7 +321,8 @@ to the system ACL file if it has not yet been authorized."
(mkdir-p (dirname %acl-file))
(with-atomic-file-output %acl-file
(cut write-acl acl <>)))))
- session))
+ session
+ become-command))
(define* (send-files local files remote
#:key
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEa1VJLOiXAjQ2BGSm9Qb9Fp2P2VoFAl1Vg6cACgkQ9Qb9Fp2P
2Voe2g//RWxOVT1M0mhS+gbGBWoepPPxuCp/E2UcakG5qzwoeibRHAv3GsC7e76x
zAHCd4klo3cQcR8NUsR9yBpu0C+1P2aW8Tc1SLfSh6p87UJD7KFRK3ihN/G4aZ86
yAPwydcfBEfFK7AfR7ioMzHXYGlHNFJCxj+fv9zTfvGplvhY1sgh7BZRwvsHoVaA
MrcaddatzZ+A4Y8pG5/MXrkphCtYVTfhx7wn0JZBi6xnW2Tna+FGx5DMDez9rEiS
W23ZkuKRqyLAe1zrmF0CtFTqVjGdRTJ1AYIP43OC87zhZy9nVy3tA2rawcbp0lF3
1s/HfHxLlCn6skHWA9AvX4wZD9eD4yZxqdA5/TGe7scVj8Eh+DFXGexht2L9g3sz
FRfJA3Ezn+OkI5JBxgMMslA9eCdjr6ppW9WIHDvIO8FrRcl1eiP6eCZoZ+VVi1rm
oEZrygdihoBqx8e50Y3xyVHX1TluDqUkeP+tfqqX+CDMLhD+ZA5SWb0icKq9Xk5K
i+HdBDOqOdya6HBlEwvX1cFgvnVk5m/SY1Sk07IFzeQZ6nKKMWxiu0CsHWx0aK+H
toyv/EHXoZarnYCn82OQdOKeuhWWbwhDr9t+iXiWXOeonc8ACYIt2XbSr/x5aIXR
KlxKWcNZpjkgZH12BcUzEjlIUq3sEP8lhztLKb5szmj7D5yCT/0=
=u5rr
-----END PGP SIGNATURE-----

C
C
Christopher Lemmer Webber wrote on 16 Aug 2019 14:47
(address . guix-patches@gnu.org)(address . 37039-done@debbugs.gnu.org)
874l2hxoni.fsf@dustycloud.org
Looks fine and simple. Merged and pushed.

Jakob L. Kreuze writes:

Toggle quote (58 lines)
> * 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.
> ---
> gnu/machine/ssh.scm | 7 +++++--
> guix/ssh.scm | 5 +++--
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
> index ac3aa3e370..aafe0ccf41 100644
> --- a/gnu/machine/ssh.scm
> +++ b/gnu/machine/ssh.scm
> @@ -126,7 +126,9 @@ an environment type of 'managed-host."
> #:build-locally?
> (machine-ssh-configuration-build-locally? config)
> #: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)
> (string->canonical-sexp
> (get-string-all port))))
> - (machine-ssh-session machine)))
> + (machine-ssh-session machine)
> + (machine-become-command machine)))
> (mlet %store-monad ((_ (check-deployment-sanity machine))
> (boot-parameters (machine-boot-parameters machine)))
> (let* ((os (machine-operating-system machine))
> diff --git a/guix/ssh.scm b/guix/ssh.scm
> index 24834c6f68..7bc499a2fe 100644
> --- a/guix/ssh.scm
> +++ b/guix/ssh.scm
> @@ -302,7 +302,7 @@ the machine on the other end of SESSION."
> (inferior-remote-eval '(begin (use-modules (guix utils)) (%current-system))
> 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
> to the system ACL file if it has not yet been authorized."
> (inferior-remote-eval
> @@ -321,7 +321,8 @@ to the system ACL file if it has not yet been authorized."
> (mkdir-p (dirname %acl-file))
> (with-atomic-file-output %acl-file
> (cut write-acl acl <>)))))
> - session))
> + session
> + become-command))
>
> (define* (send-files local files remote
> #:key
?