From 052c932e0535b5e372ec09377454213857d05000 Mon Sep 17 00:00:00 2001 From: divolgin Date: Thu, 9 Jan 2020 22:48:27 +0000 Subject: [PATCH] Treat analyzer errors as preflight check fails --- cmd/preflight/cli/run.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/preflight/cli/run.go b/cmd/preflight/cli/run.go index 4eb946b9..8ceada5e 100644 --- a/cmd/preflight/cli/run.go +++ b/cmd/preflight/cli/run.go @@ -17,7 +17,6 @@ import ( analyzerunner "github.com/replicatedhq/troubleshoot/pkg/analyze" troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1" "github.com/replicatedhq/troubleshoot/pkg/collect" - "github.com/replicatedhq/troubleshoot/pkg/logger" "github.com/spf13/viper" spin "github.com/tj/go-spin" "gopkg.in/yaml.v2" @@ -122,8 +121,11 @@ func runPreflights(v *viper.Viper, arg string) error { for _, analyzer := range preflight.Spec.Analyzers { analyzeResult, err := analyzerunner.Analyze(analyzer, getCollectedFileContents, getChildCollectedFileContents) if err != nil { - logger.Printf("an analyzer failed to run: %v\n", err) - continue + analyzeResult = &analyzerunner.AnalyzeResult{ + IsFail: true, + Title: "Analyzer Failed", + Message: err.Error(), + } } if analyzeResult != nil {