Provisioing: Update provisioned folder with a manager identity (#110988)

This commit is contained in:
Ryan McKinley
2025-09-12 10:50:10 +03:00
committed by GitHub
parent 0b9e0ef4dc
commit 1944d2dd0e
12 changed files with 123 additions and 67 deletions
@@ -40,6 +40,7 @@ type FileReader struct {
dashboardStore utils.DashboardStore
FoldersFromFilesStructure bool
folderService folder.Service
foldersInUnified bool
mux sync.RWMutex
usageTracker *usageTracker
@@ -382,6 +383,14 @@ func (fr *FileReader) getOrCreateFolder(ctx context.Context, cfg *config, servic
return 0, "", dashboards.ErrFolderInvalidUID
}
// When we expect folders in unified storage, they should have a manager indicated
if err == nil && result != nil && result.ManagedBy == "" && fr.foldersInUnified {
result, err = service.UpdateFolderWithManagedByAnnotation(ctx, result, fr.Cfg.Name)
if err != nil {
return 0, "", fmt.Errorf("unable to update provisioned folder")
}
}
// dashboard folder not found. create one.
if errors.Is(err, dashboards.ErrFolderNotFound) {
createCmd := &folder.CreateFolderCommand{