Skip to content

Commit 04c9f45

Browse files
Alerting: do not check for folder in file provisioning (grafana#84822)
provide nil folder service in file provisioning
1 parent 18eac9d commit 04c9f45

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/services/ngalert/provisioning/alert_rules.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,8 @@ func (service *AlertRuleService) ensureRuleNamespace(ctx context.Context, user i
663663
return fmt.Errorf("%w: folderUID must be set", models.ErrAlertRuleFailedValidation)
664664
}
665665

666-
if user == nil {
667-
// user is nil when this is called during file provisioning,
666+
if service.folderService == nil {
667+
// folder service is nil when this is called during file provisioning,
668668
// which already creates the folder if it does not exist
669669
return nil
670670
}

pkg/services/provisioning/provisioning.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (ps *ProvisioningServiceImpl) ProvisionAlerting(ctx context.Context) error
248248
ruleService := provisioning.NewAlertRuleService(
249249
st,
250250
st,
251-
ps.folderService,
251+
nil,
252252
ps.dashboardService,
253253
ps.quotaService,
254254
ps.SQLStore,

0 commit comments

Comments
 (0)