From eda7eb68f1b24f74ea5db49e6d7ffab60c59c1d3 Mon Sep 17 00:00:00 2001 From: Russell Centanni Date: Thu, 6 Mar 2025 13:32:55 -0500 Subject: [PATCH] fix: output report and error if 'devspace analyze --patient' times out Signed-off-by: Russell Centanni --- pkg/devspace/analyze/analyze.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/devspace/analyze/analyze.go b/pkg/devspace/analyze/analyze.go index 780da0dbe6..6635cfee12 100644 --- a/pkg/devspace/analyze/analyze.go +++ b/pkg/devspace/analyze/analyze.go @@ -63,14 +63,13 @@ func NewAnalyzer(client kubectl.Client, log log.Logger) Analyzer { // Analyze analyses a given func (a *analyzer) Analyze(namespace string, options Options) error { report, err := a.CreateReport(namespace, options) - if err != nil { - return err - } - reportString := ReportToString(report) - a.log.WriteString(logrus.InfoLevel, reportString) + if len(report) > 0 { + reportString := ReportToString(report) + a.log.WriteString(logrus.InfoLevel, reportString) + } - return nil + return err } // CreateReport creates a new report about a certain namespace @@ -141,7 +140,10 @@ func (a *analyzer) CreateReport(namespace string, options Options) ([]*ReportIte return len(report) == 0 || !options.Wait || !options.Patient, nil }) - if err != nil && len(report) == 0 { + if err != nil { + if options.Patient && len(report) > 0 { + return report, errors.Errorf("Error waiting for pod to become healthy: %v", err) + } return nil, err }