Chore: Add context to org (#40685)
* Add context to org * Rebase * Fix rebase
This commit is contained in:
@@ -22,7 +22,7 @@ type configReader struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func (cr *configReader) readConfig(path string) ([]*notificationsAsConfig, error) {
|
||||
func (cr *configReader) readConfig(ctx context.Context, path string) ([]*notificationsAsConfig, error) {
|
||||
var notifications []*notificationsAsConfig
|
||||
cr.log.Debug("Looking for alert notification provisioning files", "path", path)
|
||||
|
||||
@@ -51,7 +51,7 @@ func (cr *configReader) readConfig(path string) ([]*notificationsAsConfig, error
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := cr.checkOrgIDAndOrgName(notifications); err != nil {
|
||||
if err := cr.checkOrgIDAndOrgName(ctx, notifications); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func (cr *configReader) parseNotificationConfig(path string, file os.FileInfo) (
|
||||
return cfg.mapToNotificationFromConfig(), nil
|
||||
}
|
||||
|
||||
func (cr *configReader) checkOrgIDAndOrgName(notifications []*notificationsAsConfig) error {
|
||||
func (cr *configReader) checkOrgIDAndOrgName(ctx context.Context, notifications []*notificationsAsConfig) error {
|
||||
for i := range notifications {
|
||||
for _, notification := range notifications[i].Notifications {
|
||||
if notification.OrgID < 1 {
|
||||
@@ -91,7 +91,7 @@ func (cr *configReader) checkOrgIDAndOrgName(notifications []*notificationsAsCon
|
||||
notification.OrgID = 0
|
||||
}
|
||||
} else {
|
||||
if err := utils.CheckOrgExists(notification.OrgID); err != nil {
|
||||
if err := utils.CheckOrgExists(ctx, notification.OrgID); err != nil {
|
||||
return fmt.Errorf("failed to provision %q notification: %w", notification.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user