Skip to content

Commit 21323e7

Browse files
committed
fix: output report and error if 'devspace analyze --patient' times out
Signed-off-by: Russell Centanni <russell.centanni@gmail.com>
1 parent 6bd42de commit 21323e7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pkg/devspace/analyze/analyze.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,13 @@ func NewAnalyzer(client kubectl.Client, log log.Logger) Analyzer {
6363
// Analyze analyses a given
6464
func (a *analyzer) Analyze(namespace string, options Options) error {
6565
report, err := a.CreateReport(namespace, options)
66-
if err != nil {
67-
return err
68-
}
6966

70-
reportString := ReportToString(report)
71-
a.log.WriteString(logrus.InfoLevel, reportString)
67+
if len(report) > 0 {
68+
reportString := ReportToString(report)
69+
a.log.WriteString(logrus.InfoLevel, reportString)
70+
}
7271

73-
return nil
72+
return err
7473
}
7574

7675
// CreateReport creates a new report about a certain namespace
@@ -141,7 +140,10 @@ func (a *analyzer) CreateReport(namespace string, options Options) ([]*ReportIte
141140

142141
return len(report) == 0 || !options.Wait || !options.Patient, nil
143142
})
144-
if err != nil && len(report) == 0 {
143+
if err != nil {
144+
if options.Patient && len(report) > 0 {
145+
return report, errors.Errorf("Error waiting for pod to become healthy: %v", err)
146+
}
145147
return nil, err
146148
}
147149

0 commit comments

Comments
 (0)