19377: Usage error if config is readable but does not match env. 19377-verbose
authorTom Clegg <tom@curii.com>
Thu, 27 Oct 2022 14:07:43 +0000 (10:07 -0400)
committerTom Clegg <tom@curii.com>
Thu, 27 Oct 2022 14:07:43 +0000 (10:07 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/diagnostics/cmd.go

index c944db66607d58a612cf2febdc17816477786d42..9c229c9b4e1f4d3538cb59a06e5228a73ddc00db 100644 (file)
@@ -157,8 +157,7 @@ func (diag *diagnoser) runtests() {
                        return err
                }
                if cluster.SystemRootToken != os.Getenv("ARVADOS_API_TOKEN") {
-                       diag.infof("skipping because SystemRootToken read from %s does not match $ARVADOS_API_TOKEN (consider using 'arvados-client sudo diagnostics' to load endpoint and token from config file instead of environment)", ldr.Path)
-                       return nil
+                       return fmt.Errorf("diagnostics usage error: %s is readable but SystemRootToken does not match $ARVADOS_API_TOKEN (to fix, either run 'arvados-client sudo diagnostics' to load everything from config file, or set ARVADOS_CONFIG=- to load nothing from config file)", ldr.Path)
                }
                agg := &health.Aggregator{Cluster: cluster}
                resp := agg.ClusterHealth()