-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: json compare host analyser (#1582)
* 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>
- Loading branch information
Showing
12 changed files
with
454 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.