17344: Give up early if cluster config cannot be fetched.
authorTom Clegg <tom@curii.com>
Fri, 15 Jul 2022 16:02:48 +0000 (12:02 -0400)
committerTom Clegg <tom@curii.com>
Fri, 15 Jul 2022 16:02:48 +0000 (12:02 -0400)
Avoids unhelpful noise, like "unsupported protocol scheme" trying to
use an empty URL.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/diagnostics/cmd.go

index ed8d440b8944d20123041f86803707a2e216473d..3455d3307e71bff663aa44ea3023bf7b71efca26 100644 (file)
@@ -134,6 +134,7 @@ func (diag *diagnoser) runtests() {
 
        var cluster arvados.Cluster
        cfgpath := "arvados/v1/config"
+       cfgOK := false
        diag.dotest(20, fmt.Sprintf("getting exported config from https://%s/%s", client.APIHost, cfgpath), func() error {
                ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(diag.timeout))
                defer cancel()
@@ -142,6 +143,7 @@ func (diag *diagnoser) runtests() {
                        return err
                }
                diag.debugf("Collections.BlobSigning = %v", cluster.Collections.BlobSigning)
+               cfgOK = true
                return nil
        })
 
@@ -157,6 +159,11 @@ func (diag *diagnoser) runtests() {
                return nil
        })
 
+       if !cfgOK {
+               diag.errorf("cannot proceed without cluster config -- aborting without running any further tests")
+               return
+       }
+
        // uncomment to create some spurious errors
        // cluster.Services.WebDAVDownload.ExternalURL.Host = "0.0.0.0:9"