[v11.0.x] Provisioning: Look up provisioned folders by UID when possible (#87468)

Provisioning: Look up provisioned folders by UID when possible (#87465)

look up provisioned folders by uid when possible

(cherry picked from commit 1884b03511)

Co-authored-by: Dan Cech <dcech@grafana.com>
pull/87484/head
grafana-delivery-bot[bot] 1 year ago committed by GitHub
parent 9f15deb1cb
commit 60611c56eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      pkg/services/provisioning/dashboards/file_reader.go

@ -339,10 +339,16 @@ func (fr *FileReader) getOrCreateFolder(ctx context.Context, cfg *config, servic
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.Provisioning).Inc()
cmd := &dashboards.GetDashboardQuery{
Title: &folderName,
FolderID: util.Pointer(int64(0)), // nolint:staticcheck
OrgID: cfg.OrgID,
}
if cfg.FolderUID != "" {
cmd.UID = cfg.FolderUID
} else {
cmd.Title = &folderName
}
result, err := fr.dashboardStore.GetDashboard(ctx, cmd)
if err != nil && !errors.Is(err, dashboards.ErrDashboardNotFound) {

Loading…
Cancel
Save