Sfoglia il codice sorgente

Renamed validation funcs for alert notification

Pavel Bakulev 7 anni fa
parent
commit
6d1ec19fe9

+ 4 - 8
pkg/services/provisioning/alert_notifications/config_reader.go

@@ -41,12 +41,9 @@ func (cr *configReader) readConfig(path string) ([]*notificationsAsConfig, error
 	}
 	}
 
 
 	cr.log.Debug("Validating alert notifications")
 	cr.log.Debug("Validating alert notifications")
-	err = validateDefaultUniqueness(notifications)
-	if err != nil {
-		return nil, err
-	}
+	validateOrgIdAndSet(notifications)
 
 
-	err = validateType(notifications)
+	err = validateNotifications(notifications)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -70,7 +67,7 @@ func (cr *configReader) parseNotificationConfig(path string, file os.FileInfo) (
 	return cfg.mapToNotificationFromConfig(), nil
 	return cfg.mapToNotificationFromConfig(), nil
 }
 }
 
 
-func validateDefaultUniqueness(notifications []*notificationsAsConfig) error {
+func validateOrgIdAndSet(notifications []*notificationsAsConfig) {
 	for i := range notifications {
 	for i := range notifications {
 		for _, notification := range notifications[i].Notifications {
 		for _, notification := range notifications[i].Notifications {
 			if notification.OrgId < 1 {
 			if notification.OrgId < 1 {
@@ -93,10 +90,9 @@ func validateDefaultUniqueness(notifications []*notificationsAsConfig) error {
 		}
 		}
 	}
 	}
 
 
-	return nil
 }
 }
 
 
-func validateType(notifications []*notificationsAsConfig) error {
+func validateNotifications(notifications []*notificationsAsConfig) error {
 	notifierTypes := alerting.GetNotifiers()
 	notifierTypes := alerting.GetNotifiers()
 
 
 	for i := range notifications {
 	for i := range notifications {