Remove version from RuleGroups
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
parent
37e7b69f56
commit
592cb00c2f
|
@ -232,7 +232,6 @@ func updateRules(t cli.Term, filename string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
yamlRG := &rulefmt.RuleGroups{
|
yamlRG := &rulefmt.RuleGroups{
|
||||||
Version: 1,
|
|
||||||
Groups: []rulefmt.RuleGroup{{
|
Groups: []rulefmt.RuleGroup{{
|
||||||
Name: filename,
|
Name: filename,
|
||||||
}},
|
}},
|
||||||
|
|
|
@ -37,8 +37,7 @@ func (err *Error) Error() string {
|
||||||
|
|
||||||
// RuleGroups is a set of rule groups that are typically exposed in a file.
|
// RuleGroups is a set of rule groups that are typically exposed in a file.
|
||||||
type RuleGroups struct {
|
type RuleGroups struct {
|
||||||
Version int `yaml:"version"`
|
Groups []RuleGroup `yaml:"groups"`
|
||||||
Groups []RuleGroup `yaml:"groups"`
|
|
||||||
|
|
||||||
// Catches all undefined fields and must be empty after parsing.
|
// Catches all undefined fields and must be empty after parsing.
|
||||||
XXX map[string]interface{} `yaml:",inline"`
|
XXX map[string]interface{} `yaml:",inline"`
|
||||||
|
@ -46,9 +45,6 @@ type RuleGroups struct {
|
||||||
|
|
||||||
// Validate validates all rules in the rule groups.
|
// Validate validates all rules in the rule groups.
|
||||||
func (g *RuleGroups) Validate() (errs []error) {
|
func (g *RuleGroups) Validate() (errs []error) {
|
||||||
if g.Version != 1 {
|
|
||||||
errs = append(errs, errors.Errorf("invalid rule group version %d", g.Version))
|
|
||||||
}
|
|
||||||
set := map[string]struct{}{}
|
set := map[string]struct{}{}
|
||||||
|
|
||||||
for _, g := range g.Groups {
|
for _, g := range g.Groups {
|
||||||
|
|
|
@ -37,10 +37,6 @@ func TestParseFileFailure(t *testing.T) {
|
||||||
filename: "duplicate_grp.bad.yaml",
|
filename: "duplicate_grp.bad.yaml",
|
||||||
errMsg: "groupname: \"yolo\" is repeated in the same file",
|
errMsg: "groupname: \"yolo\" is repeated in the same file",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
filename: "noversion.bad.yaml",
|
|
||||||
errMsg: "invalid rule group version 0",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
filename: "bad_expr.bad.yaml",
|
filename: "bad_expr.bad.yaml",
|
||||||
errMsg: "parse error",
|
errMsg: "parse error",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
- name: yolo
|
- name: yolo
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
groups:
|
|
||||||
- name: yolo
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: yolo
|
- name: yolo
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: 1
|
|
||||||
groups:
|
groups:
|
||||||
- name: my-group-name
|
- name: my-group-name
|
||||||
interval: 30s # defaults to global interval
|
interval: 30s # defaults to global interval
|
||||||
|
|
Loading…
Reference in New Issue