Files
Evans Mungai 73201c0304 feat: Add regex host analyser (#1267)
* feat: Add regular expressions host anaylser

This anaylser is the same as the in-cluster text anaylser. You pass in
search expressions to find values in files collected in a bundle

* additional test assertion to check analyser warn
2023-07-18 07:18:53 +12:00

25 lines
749 B
Go

package analyzer
import (
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
)
// AnalyzeHostTextAnalyze implements HostAnalyzer interface
type AnalyzeHostTextAnalyze struct {
hostAnalyzer *troubleshootv1beta2.TextAnalyze
}
func (a *AnalyzeHostTextAnalyze) Title() string {
return hostAnalyzerTitleOrDefault(a.hostAnalyzer.AnalyzeMeta, "Regular Expression")
}
func (a *AnalyzeHostTextAnalyze) IsExcluded() (bool, error) {
return isExcluded(a.hostAnalyzer.Exclude)
}
func (a *AnalyzeHostTextAnalyze) Analyze(
getCollectedFileContents func(string) ([]byte, error), findFiles getChildCollectedFileContents,
) ([]*AnalyzeResult, error) {
return analyzeTextAnalyze(a.hostAnalyzer, findFiles, a.Title())
}