Provisioing: Update provisioned folder with a manager identity (#110988)
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user