mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
fix bug missing an error. (#7020)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
bdc45c2b9e
commit
51c824543b
|
@ -264,12 +264,22 @@ func Parse(content []byte) (*RuleGroups, []error) {
|
||||||
var (
|
var (
|
||||||
groups RuleGroups
|
groups RuleGroups
|
||||||
node ruleGroups
|
node ruleGroups
|
||||||
|
errs []error
|
||||||
)
|
)
|
||||||
|
|
||||||
err := yaml.Unmarshal(content, &groups)
|
err := yaml.Unmarshal(content, &groups)
|
||||||
_err := yaml.Unmarshal(content, &node)
|
if err != nil {
|
||||||
if err != nil || _err != nil {
|
errs = append(errs, err)
|
||||||
return nil, []error{err}
|
|
||||||
}
|
}
|
||||||
|
err = yaml.Unmarshal(content, &node)
|
||||||
|
if err != nil {
|
||||||
|
errs = append(errs, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(errs) > 0 {
|
||||||
|
return nil, errs
|
||||||
|
}
|
||||||
|
|
||||||
return &groups, groups.Validate(node)
|
return &groups, groups.Validate(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue