Fix empty isEqual in amtool. (#2668)

This is the best we can do to make amtool support old releases.

Supersedes #2634
Fix #2666

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto 2021-08-06 11:11:16 +02:00 committed by GitHub
parent 3a9808c3f7
commit e21cdfbc52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,11 @@ func FormatDate(input strfmt.DateTime) string {
func labelsMatcher(m models.Matcher) *labels.Matcher {
var t labels.MatchType
// Support for older alertmanager releases, which did not support isEqual.
if m.IsEqual == nil {
isEqual := true
m.IsEqual = &isEqual
}
switch {
case !*m.IsRegex && *m.IsEqual:
t = labels.MatchEqual