mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
* feat: json compore host analyser Signed-off-by: Evans Mungai <evans@replicated.com> * Add missing json compare host analyser file Signed-off-by: Evans Mungai <evans@replicated.com> * Generate schemas Signed-off-by: Evans Mungai <evans@replicated.com> * Fix failing tests Signed-off-by: Evans Mungai <evans@replicated.com> * Ensure json compare analyser always has a title Signed-off-by: Evans Mungai <evans@replicated.com> --------- Signed-off-by: Evans Mungai <evans@replicated.com>
29 lines
804 B
Go
29 lines
804 B
Go
package analyzer
|
|
|
|
import (
|
|
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
|
|
)
|
|
|
|
type AnalyzeHostJsonCompare struct {
|
|
hostAnalyzer *troubleshootv1beta2.JsonCompare
|
|
}
|
|
|
|
func (a *AnalyzeHostJsonCompare) Title() string {
|
|
return jsonCompareTitle(a.hostAnalyzer)
|
|
}
|
|
|
|
func (a *AnalyzeHostJsonCompare) IsExcluded() (bool, error) {
|
|
return isExcluded(a.hostAnalyzer.Exclude)
|
|
}
|
|
|
|
func (a *AnalyzeHostJsonCompare) Analyze(
|
|
getCollectedFileContents func(string) ([]byte, error), findFiles getChildCollectedFileContents,
|
|
) ([]*AnalyzeResult, error) {
|
|
result, err := analyzeJsonCompare(a.hostAnalyzer, getCollectedFileContents, a.Title())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
result.Strict = a.hostAnalyzer.Strict.BoolOrDefaultFalse()
|
|
return []*AnalyzeResult{result}, nil
|
|
}
|