Skip to content

Commit

Permalink
Provisioning: Look up provisioned folders by UID when possible (grafa…
Browse files Browse the repository at this point in the history
…na#87465)

look up provisioned folders by uid when possible
  • Loading branch information
DanCech authored May 7, 2024
1 parent a9da6ce commit 1884b03
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/services/provisioning/dashboards/file_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1884b03

Please sign in to comment.