Skip to content

Commit

Permalink
Handle analysis when storing preflights to bundle in /tmp
Browse files Browse the repository at this point in the history
Signed-off-by: Evans Mungai <evans@replicated.com>
  • Loading branch information
banjoh committed Sep 13, 2024
1 parent 01e942a commit 144cfe4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/preflight/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package preflight

import (
"bytes"
"context"
"encoding/json"
"os"
"path/filepath"
Expand Down Expand Up @@ -157,7 +158,16 @@ func Execute(preflightSpec *troubleshootv1beta2.Preflight, ignorePermissionError
uploadPreflightResults.Errors = rbacErrors
} else {
logger.Info("preflight analyze phase")
analyzeResults := collectResults.Analyze()
var analyzeResults []*troubleshootanalyze.AnalyzeResult
if bundlePath == "" {
analyzeResults = collectResults.Analyze()
} else {
ctx := context.Background()
analyzeResults, err = troubleshootanalyze.AnalyzeLocal(ctx, bundlePath, preflightSpec.Spec.Analyzers, nil)
if err != nil {
return nil, errors.Wrap(err, "failed to analyze preflights from local bundle")
}
}

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

0 comments on commit 144cfe4

Please sign in to comment.