Linting fixes for the provisioning package (#25690)

This commit is contained in:
Carl Bergquist
2020-06-30 22:46:41 +02:00
committed by GitHub
parent 891ae24f76
commit db8d7ffbf6
7 changed files with 102 additions and 78 deletions
@@ -46,7 +46,7 @@ func (cr *configReader) readConfig(path string) ([]*notificationsAsConfig, error
return nil, err
}
checkOrgIdAndOrgName(notifications)
checkOrgIDAndOrgName(notifications)
err = validateNotifications(notifications)
if err != nil {
@@ -72,24 +72,24 @@ func (cr *configReader) parseNotificationConfig(path string, file os.FileInfo) (
return cfg.mapToNotificationFromConfig(), nil
}
func checkOrgIdAndOrgName(notifications []*notificationsAsConfig) {
func checkOrgIDAndOrgName(notifications []*notificationsAsConfig) {
for i := range notifications {
for _, notification := range notifications[i].Notifications {
if notification.OrgId < 1 {
if notification.OrgID < 1 {
if notification.OrgName == "" {
notification.OrgId = 1
notification.OrgID = 1
} else {
notification.OrgId = 0
notification.OrgID = 0
}
}
}
for _, notification := range notifications[i].DeleteNotifications {
if notification.OrgId < 1 {
if notification.OrgID < 1 {
if notification.OrgName == "" {
notification.OrgId = 1
notification.OrgID = 1
} else {
notification.OrgId = 0
notification.OrgID = 0
}
}
}
@@ -107,7 +107,7 @@ func validateRequiredField(notifications []*notificationsAsConfig) error {
)
}
if notification.Uid == "" {
if notification.UID == "" {
errStrings = append(
errStrings,
fmt.Sprintf("Added alert notification item %d in configuration doesn't contain required field uid", index+1),
@@ -123,7 +123,7 @@ func validateRequiredField(notifications []*notificationsAsConfig) error {
)
}
if notification.Uid == "" {
if notification.UID == "" {
errStrings = append(
errStrings,
fmt.Sprintf("Deleted alert notification item %d in configuration doesn't contain required field uid", index+1),
@@ -149,7 +149,7 @@ func validateNotifications(notifications []*notificationsAsConfig) error {
for _, notification := range notifications[i].Notifications {
_, err := alerting.InitNotifier(&models.AlertNotification{
Name: notification.Name,
Settings: notification.SettingsToJson(),
Settings: notification.SettingsToJSON(),
Type: notification.Type,
})