-
Notifications
You must be signed in to change notification settings - Fork 38
Description
update_dashboard pulls the folderId out of the meta dictionary if it's not in the main dashboard payload, but it should be doing the same thing for the folderUid
To Reproduce
Steps to reproduce the behavior:
- Start with a folder that contains a dashboard
- folderDef = get_folder(
- dashboardDef = get_dashabord()
- delete_dashboard()
- delete_folder()
- create_folder(uid=folderDef['uid'], title=foldlerDef['title'])
- update_dashboard(dashboardDef)
I would expect the create_dashboard call in step 8 to transparently accept the dashboard payload I grabbed in step 3, but instead, there's an exception saying "folder not found" because the folder created in step 7 has the same UID as the original, but grafana auto-assigns the ID, and update_dashboard only looks at the dashboardDef['meta']['folderId'], ignoring dashboardDef['meta']['folderUid']. A workaround is to push the folderUid into the top level payload on my own, but I think it's reasonable to expect that reading a dashboard payload and then writing it again unmodified should work.
Versions
- Grafana: 11.3
grafana-client: 4.3.0- Authentication: Basic
Additional context
This problem arises from trying to export dashboards and folders from an instance of Grafana, then import them into a different instance or the same instance that's been modified. The deletes in steps 3 and 4 represent a 'fresh' instance. I understand that these kinds of backup/restore/import/export usecases are a pretty common reason to use the client library, so I think it would be good if it worked intuitively in those cases.