mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-08-27 00:37:20 +00:00
Allow text analyzer to not generate an error if no files match
This commit is contained in:
@@ -1070,6 +1070,8 @@ spec:
|
||||
type: BoolString
|
||||
fileName:
|
||||
type: string
|
||||
ignoreIfNoFiles:
|
||||
type: boolean
|
||||
outcomes:
|
||||
items:
|
||||
properties:
|
||||
|
||||
@@ -1070,6 +1070,8 @@ spec:
|
||||
type: BoolString
|
||||
fileName:
|
||||
type: string
|
||||
ignoreIfNoFiles:
|
||||
type: boolean
|
||||
outcomes:
|
||||
items:
|
||||
properties:
|
||||
|
||||
@@ -1101,6 +1101,8 @@ spec:
|
||||
type: BoolString
|
||||
fileName:
|
||||
type: string
|
||||
ignoreIfNoFiles:
|
||||
type: boolean
|
||||
outcomes:
|
||||
items:
|
||||
properties:
|
||||
|
||||
@@ -24,12 +24,16 @@ func analyzeTextAnalyze(analyzer *troubleshootv1beta2.TextAnalyze, getCollectedF
|
||||
}
|
||||
|
||||
if len(collected) == 0 {
|
||||
if analyzer.IgnoreIfNoFiles {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return []*AnalyzeResult{
|
||||
{
|
||||
Title: checkName,
|
||||
IconKey: "kubernetes_text_analyze",
|
||||
IconURI: "https://troubleshoot.sh/images/analyzer-icons/text-analyze.svg",
|
||||
IsFail: false,
|
||||
IsWarn: true,
|
||||
Message: "No matching files",
|
||||
},
|
||||
}, nil
|
||||
|
||||
@@ -117,12 +117,13 @@ type NodeResourceSelectors struct {
|
||||
}
|
||||
|
||||
type TextAnalyze struct {
|
||||
AnalyzeMeta `json:",inline" yaml:",inline"`
|
||||
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
|
||||
FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"`
|
||||
RegexPattern string `json:"regex,omitempty" yaml:"regex,omitempty"`
|
||||
RegexGroups string `json:"regexGroups,omitempty" yaml:"regexGroups,omitempty"`
|
||||
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
|
||||
AnalyzeMeta `json:",inline" yaml:",inline"`
|
||||
CollectorName string `json:"collectorName,omitempty" yaml:"collectorName,omitempty"`
|
||||
FileName string `json:"fileName,omitempty" yaml:"fileName,omitempty"`
|
||||
RegexPattern string `json:"regex,omitempty" yaml:"regex,omitempty"`
|
||||
RegexGroups string `json:"regexGroups,omitempty" yaml:"regexGroups,omitempty"`
|
||||
IgnoreIfNoFiles bool `json:"ignoreIfNoFiles,omitempty" yaml:"ignoreIfNoFiles,omitempty"`
|
||||
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
|
||||
}
|
||||
|
||||
type DatabaseAnalyze struct {
|
||||
|
||||
@@ -1615,6 +1615,9 @@
|
||||
"fileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"ignoreIfNoFiles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"outcomes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@@ -1615,6 +1615,9 @@
|
||||
"fileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"ignoreIfNoFiles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"outcomes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@@ -1661,6 +1661,9 @@
|
||||
"fileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"ignoreIfNoFiles": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"outcomes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
Reference in New Issue
Block a user