offload: Gracefully report connection failures.

* guix/scripts/offload.scm (open-ssh-session): Check the return value of
'connect!'.  Call 'leave' when it's not 'ok.
This commit is contained in:
Ludovic Courtès 2016-12-01 23:20:18 +01:00
parent 6374633b92
commit 74afca5dcf
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 26 additions and 22 deletions

View File

@ -177,8 +177,8 @@ private key from '~a': ~a")
;; exchanging full archives.
#:compression "zlib"
#:compression-level 3)))
(connect! session)
(match (connect! session)
('ok
;; Authenticate the server. XXX: Guile-SSH 0.10.1 doesn't know about
;; ed25519 keys and 'get-key-type' returns #f in that case.
(let-values (((server) (get-server-public-key session))
@ -201,7 +201,11 @@ instead of '~a' of type '~a'~%")
(leave (_ "SSH public key authentication failed for '~a': ~a~%")
(build-machine-name machine) (get-error session))))
session))
session)
(x
;; Connection failed or timeout expired.
(leave (_ "failed to connect to '~a': ~a~%")
(build-machine-name machine) (get-error session))))))
(define* (connect-to-remote-daemon session
#:optional