Skip to content

Commit

Permalink
Fix broken Nrpe dashboard (#389)
Browse files Browse the repository at this point in the history
* conditional popping

* bump
  • Loading branch information
michaeldmitry authored Feb 7, 2025
1 parent ff6bda1 commit dcc34d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/charms/grafana_k8s/v0/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def __init__(self, *args):
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version

LIBPATCH = 40
LIBPATCH = 41

PYDEPS = ["cosl >= 0.0.50"]

Expand Down Expand Up @@ -633,7 +633,10 @@ def _replace_template_fields( # noqa: C901
deletions = []
for tmpl in dict_content["templating"]["list"]:
if tmpl["name"] and tmpl["name"] in used_replacements:
deletions.append(tmpl)
# it might happen that existing template var name is the same as the one we insert (i.e prometheusds or lokids)
# in that case, we want to pop the existing one only.
if tmpl not in DATASOURCE_TEMPLATE_DROPDOWNS:
deletions.append(tmpl)

for d in deletions:
dict_content["templating"]["list"].remove(d)
Expand Down

0 comments on commit dcc34d7

Please sign in to comment.