fix mute: parse regexp (#1044)

This commit is contained in:
ulricqin 2022-07-12 16:39:23 +08:00 committed by GitHub
parent 616674b643
commit d508aef7e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -88,12 +88,12 @@ func (m *AlertMute) Parse() error {
}
for i := 0; i < len(m.ITags); i++ {
if m.ITags[i].Func == "=~" {
if m.ITags[i].Func == "=~" || m.ITags[i].Func == "!~" {
m.ITags[i].Regexp, err = regexp.Compile(m.ITags[i].Value)
if err != nil {
return err
}
} else if m.ITags[i].Func == "in" {
} else if m.ITags[i].Func == "in" || m.ITags[i].Func == "not in" {
arr := strings.Fields(m.ITags[i].Value)
m.ITags[i].Vset = make(map[string]struct{})
for j := 0; j < len(arr); j++ {