[v10.4.x] Provisioning: Look up provisioned folders by UID when possible (#87467)

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>
This commit is contained in:
grafana-delivery-bot[bot]
2024-05-07 22:54:06 +03:00
committed by GitHub
co-authored by Dan Cech
parent 2fcd898227
commit d05e50ee42
@@ -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) {