Commit 415ff7950dd7001e74c9a6929ebd3fbdfb43f0bf

Thomas de Grivel 2015-09-18T04:04:34

Allow specifying user for ssh connection.

diff --git a/core/host.lisp b/core/host.lisp
index 33a744f..2dbbcb1 100644
--- a/core/host.lisp
+++ b/core/host.lisp
@@ -38,13 +38,21 @@
     (or #1=(get-resource 'host id)
         (setf #1# (make-instance 'host :id id)))))
 
+(defun host-user (host)
+  (specified-property host :user))
+
 (defun host-connect (host)
   (let ((id (resource-id host)))
     (cond
       ((string-equal (local-hostname) id)
-       (setf (host-shell host) (make-shell)))
+       (setf (host-shell host) (make-shell "/bin/sh")))
       (:otherwise
-       (setf (host-shell host) (make-shell "/usr/bin/ssh" id))))))
+       (let ((user (host-user host)))
+         (setf (host-shell host)
+               (apply #'make-shell
+                      `("/usr/bin/ssh"
+                        ,@(when user `("-l" ,user))
+                        ,id "/bin/sh"))))))))
 
 (defun current-host ()
   (or (when (boundp '*host*)