dangogh closed pull request #2091: Fix TM to warn not err on matchset without regex URL: https://github.com/apache/trafficcontrol/pull/2091
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/traffic_monitor/todata/todata.go b/traffic_monitor/todata/todata.go index 47b85f52b..44d12c0cc 100644 --- a/traffic_monitor/todata/todata.go +++ b/traffic_monitor/todata/todata.go @@ -22,11 +22,13 @@ package todata import ( "encoding/json" "fmt" - "github.com/apache/trafficcontrol/lib/go-tc" - "github.com/apache/trafficcontrol/traffic_monitor/towrap" "regexp" "strings" "sync" + + "github.com/apache/trafficcontrol/lib/go-log" + "github.com/apache/trafficcontrol/lib/go-tc" + "github.com/apache/trafficcontrol/traffic_monitor/towrap" ) // Regexes maps Delivery Service Regular Expressions to delivery services. @@ -202,15 +204,16 @@ func getDeliveryServiceRegexes(crc CRConfig) (Regexes, error) { dsRegexes := map[tc.DeliveryServiceName][]string{} for dsName, dsData := range crc.DeliveryServices { - if len(dsData.Matchsets) < 1 { - return Regexes{}, fmt.Errorf("CRConfig missing regex for '%s'", dsName) - } for _, matchset := range dsData.Matchsets { if len(matchset.MatchList) < 1 { - return Regexes{}, fmt.Errorf("CRConfig missing Regex for '%s'", dsName) + log.Warnln("CRConfig missing regex for delivery service '" + string(dsName) + "' matchset protocol '" + matchset.Protocol + "'") + continue } dsRegexes[dsName] = append(dsRegexes[dsName], matchset.MatchList[0].Regex) } + if len(dsRegexes[dsName]) == 0 { + return Regexes{}, fmt.Errorf("CRConfig missing regex for '%s'", dsName) + } } return createRegexes(dsRegexes) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services