From: Tom Clegg Date: Wed, 3 Feb 2021 20:35:33 +0000 (-0500) Subject: 17170: Improve error messages and command help text. X-Git-Tag: 2.2.0~135^2~1 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/60a72f91316ab1d878420adceb98e585c0e3b72f 17170: Improve error messages and command help text. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/cmd/arvados-client/container_gateway.go b/cmd/arvados-client/container_gateway.go index 6dbc241bca..e3b6b9332c 100644 --- a/cmd/arvados-client/container_gateway.go +++ b/cmd/arvados-client/container_gateway.go @@ -13,6 +13,7 @@ import ( "net/url" "os" "os/exec" + "path/filepath" "strings" "syscall" @@ -28,6 +29,7 @@ func (shellCommand) RunCommand(prog string, args []string, stdin io.Reader, stdo f := flag.NewFlagSet(prog, flag.ContinueOnError) f.SetOutput(stderr) f.Usage = func() { + _, prog := filepath.Split(prog) fmt.Fprint(stderr, prog+`: open an interactive shell on a running container. Usage: `+prog+` [options] [username@]container-uuid [ssh-options] [remote-command [args...]] @@ -105,8 +107,12 @@ func (connectSSHCommand) RunCommand(prog string, args []string, stdin io.Reader, f := flag.NewFlagSet(prog, flag.ContinueOnError) f.SetOutput(stderr) f.Usage = func() { + _, prog := filepath.Split(prog) fmt.Fprint(stderr, prog+`: connect to the gateway service for a running container. +NOTE: You almost certainly don't want to use this command directly. It +is meant to be used internally. Use "arvados-client shell" instead. + Usage: `+prog+` [options] [username@]container-uuid Options: diff --git a/lib/controller/localdb/container_gateway.go b/lib/controller/localdb/container_gateway.go index e509278773..3b40eccaff 100644 --- a/lib/controller/localdb/container_gateway.go +++ b/lib/controller/localdb/container_gateway.go @@ -63,15 +63,15 @@ func (conn *Conn) ContainerSSH(ctx context.Context, opts arvados.ContainerSSHOpt switch ctr.State { case arvados.ContainerStateQueued, arvados.ContainerStateLocked: - err = httpserver.ErrorWithStatus(fmt.Errorf("gateway is not available, container is %s", strings.ToLower(string(ctr.State))), http.StatusServiceUnavailable) + err = httpserver.ErrorWithStatus(fmt.Errorf("container is not running yet (state is %q)", ctr.State), http.StatusServiceUnavailable) return case arvados.ContainerStateRunning: if ctr.GatewayAddress == "" { - err = httpserver.ErrorWithStatus(errors.New("container is running but gateway is not available"), http.StatusServiceUnavailable) + err = httpserver.ErrorWithStatus(errors.New("container is running but gateway is not available -- installation problem or feature not supported"), http.StatusServiceUnavailable) return } default: - err = httpserver.ErrorWithStatus(fmt.Errorf("gateway is not available, container is %s", strings.ToLower(string(ctr.State))), http.StatusGone) + err = httpserver.ErrorWithStatus(fmt.Errorf("container has ended (state is %q)", ctr.State), http.StatusGone) return } // crunch-run uses a self-signed / unverifiable TLS