diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index aaad992289cbd5446b511e7a0351fddf420a3790..d011520885bf55342ad841e83f2fe4a2d6cdc7a7 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -542,8 +542,7 @@ (define (assert-node-repl node name) "Bail out if NODE is not running Guile." (match (node-guile-version node) (#f - (leave (G_ "Guile could not be started on '~a'~%") - name)) + (report-guile-error name)) ((? string? version) ;; Note: The version string already contains the word "Guile". (info (G_ "'~a' is running ~a~%") @@ -551,6 +550,17 @@ (define (assert-node-repl node name) (define (assert-node-has-guix node name) "Bail out if NODE lacks the (guix) module, or if its daemon is not running." + (catch 'node-repl-error + (lambda () + (match (node-eval node + '(begin + (use-modules (guix)) + (and add-text-to-store 'alright))) + ('alright #t) + (_ (report-module-error name)))) + (lambda (key . args) + (report-module-error name))) + (catch 'node-repl-error (lambda () (match (node-eval node @@ -563,7 +573,7 @@ (define (assert-node-has-guix node name) (info (G_ "Guix is usable on '~a' (test returned ~s)~%") name str)) (x - (leave (G_ "failed to use Guix module on '~a' (test returned ~s)~%") + (leave (G_ "failed to talk to guix-daemon on '~a' (test returned ~s)~%") name x)))) (lambda (key . args) (leave (G_ "remove evaluation on '~a' failed:~{ ~s~}~%") diff --git a/guix/ssh.scm b/guix/ssh.scm index ac8569298bd22805994324da02121334f9087029..4dcc6d38bbe4b3c135a2a01f78f128fb69c5f11a 100644 --- a/guix/ssh.scm +++ b/guix/ssh.scm @@ -41,7 +41,10 @@ (define-module (guix ssh) send-files retrieve-files retrieve-files* - remote-store-host)) + remote-store-host + + report-guile-error + report-module-error)) ;;; Commentary: ;;; @@ -365,21 +368,9 @@ (define* (retrieve-files* files remote (lambda () (close-port port)))) ((? eof-object?) - (raise-error (G_ "failed to start Guile on remote host '~A': exit code ~A") - (remote-store-host remote) - (channel-get-exit-status port) - (=> (G_ "Make sure @command{guile} can be found in -@code{$PATH} on the remote host. Run @command{ssh ~A guile --version} to -check.") - (remote-store-host remote)))) + (report-guile-error (remote-store-host remote))) (('module-error . _) - ;; TRANSLATORS: Leave "Guile" untranslated. - (raise-error (G_ "Guile modules not found on remote host '~A'") - (remote-store-host remote) - (=> (G_ "Make sure @code{GUILE_LOAD_PATH} includes Guix' -own module directory. Run @command{ssh ~A env | grep GUILE_LOAD_PATH} to -check.") - (remote-store-host remote)))) + (report-module-error (remote-store-host remote))) (('connection-error file code . _) (raise-error (G_ "failed to connect to '~A' on remote host '~A': ~a") file (remote-store-host remote) (strerror code))) @@ -406,4 +397,25 @@ (define* (retrieve-files local files remote #:import (lambda (port) (import-paths local port)))) + +;;; +;;; Error reporting. +;;; + +(define (report-guile-error host) + (raise-error (G_ "failed to start Guile on remote host '~A'") host + (=> (G_ "Make sure @command{guile} can be found in +@code{$PATH} on the remote host. Run @command{ssh ~A guile --version} to +check.") + host))) + +(define (report-module-error host) + "Report an error about missing Guix modules on HOST." + ;; TRANSLATORS: Leave "Guile" untranslated. + (raise-error (G_ "Guile modules not found on remote host '~A'") host + (=> (G_ "Make sure @code{GUILE_LOAD_PATH} includes Guix' +own module directory. Run @command{ssh ~A env | grep GUILE_LOAD_PATH} to +check.") + host))) + ;;; ssh.scm ends here