Skip to content

Commit

Permalink
fixe folder_uid when dashboard has no folder (ysde#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
peekjef72 authored and azman0101 committed Jun 17, 2022
1 parent 6bb549b commit c55104d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion grafana_backup/dashboardApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ def get_folder_id(dashboard, grafana_url, http_post_headers, verify_ssl, client_
folder_uid = dashboard['meta']['folderUid']
except (KeyError):
matches = re.search('dashboards\/f\/(.*)\/.*', dashboard['meta']['folderUrl'])
folder_uid = matches.group(1)
if matches is not None:
folder_uid = matches.group(1)
else:
folder_uid = '0'

if (folder_uid != ""):
print("debug: quering with uid {}".format(folder_uid))
Expand Down

0 comments on commit c55104d

Please sign in to comment.