From f2806b334e4c7338c5df4f4960fd6d91b19fbf45 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sat, 13 Apr 2024 12:46:45 +0200 Subject: [PATCH] Cleanup logic to populate variables no longer needed --- deploy.py | 78 ------------------------------------------------------- 1 file changed, 78 deletions(-) diff --git a/deploy.py b/deploy.py index 1cf8694..24be9e5 100755 --- a/deploy.py +++ b/deploy.py @@ -3,15 +3,12 @@ import hashlib import json import os -import re import shutil import ssl import subprocess -from copy import deepcopy from functools import partial from glob import glob from urllib.error import HTTPError -from urllib.parse import urlencode from urllib.request import Request, urlopen # UID for the folder under which our dashboards will be setup @@ -94,86 +91,11 @@ def deploy_dashboard(dashboard_path, folder_uid, api): # folder compared to initially deployed to the first folder. db['uid'] = hashlib.sha256((dashboard_path + folder_uid).encode()).hexdigest()[:16] - db = populate_template_variables(api, db) - # api ref: https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/#create--update-dashboard data = {'dashboard': db, 'folderUid': folder_uid, 'overwrite': True} api('/dashboards/db', data) -def get_label_values(api, ds_id, template_query): - """ - Return response to a `label_values` template query - - `label_values` isn't actually a prometheus thing - it is an API call that - grafana makes. This function tries to mimic that. Useful for populating variables - in a dashboard - """ - # re.DOTALL allows the query to be multi-line - match = re.match( - r'label_values\((?P.*),\s*(?P