Alerting: do not check for folder in file provisioning (#84822)

provide nil folder service in file provisioning
pull/84825/head
Yuri Tseretyan 1 year ago committed by GitHub
parent 18eac9df9e
commit 04c9f459ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/services/ngalert/provisioning/alert_rules.go
  2. 2
      pkg/services/provisioning/provisioning.go

@ -663,8 +663,8 @@ func (service *AlertRuleService) ensureRuleNamespace(ctx context.Context, user i
return fmt.Errorf("%w: folderUID must be set", models.ErrAlertRuleFailedValidation)
}
if user == nil {
// user is nil when this is called during file provisioning,
if service.folderService == nil {
// folder service is nil when this is called during file provisioning,
// which already creates the folder if it does not exist
return nil
}

@ -248,7 +248,7 @@ func (ps *ProvisioningServiceImpl) ProvisionAlerting(ctx context.Context) error
ruleService := provisioning.NewAlertRuleService(
st,
st,
ps.folderService,
nil,
ps.dashboardService,
ps.quotaService,
ps.SQLStore,

Loading…
Cancel
Save