Skip to content

Commit 144cfe4

Browse files
committed
Handle analysis when storing preflights to bundle in /tmp
Signed-off-by: Evans Mungai <[email protected]>
1 parent 01e942a commit 144cfe4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/preflight/execute.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package preflight
22

33
import (
44
"bytes"
5+
"context"
56
"encoding/json"
67
"os"
78
"path/filepath"
@@ -157,7 +158,16 @@ func Execute(preflightSpec *troubleshootv1beta2.Preflight, ignorePermissionError
157158
uploadPreflightResults.Errors = rbacErrors
158159
} else {
159160
logger.Info("preflight analyze phase")
160-
analyzeResults := collectResults.Analyze()
161+
var analyzeResults []*troubleshootanalyze.AnalyzeResult
162+
if bundlePath == "" {
163+
analyzeResults = collectResults.Analyze()
164+
} else {
165+
ctx := context.Background()
166+
analyzeResults, err = troubleshootanalyze.AnalyzeLocal(ctx, bundlePath, preflightSpec.Spec.Analyzers, nil)
167+
if err != nil {
168+
return nil, errors.Wrap(err, "failed to analyze preflights from local bundle")
169+
}
170+
}
161171

162172
// the typescript api added some flair to this result
163173
// so let's keep it for compatibility

0 commit comments

Comments
 (0)