Skip to content

Commit

Permalink
construct files in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
edobry committed Jan 16, 2025
1 parent 146187d commit b38742b
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/observability/grafana/grafana_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ def provision_dashboards(plan, service_url, dashboard_sources):
"grr config create-context kurtosis",
]

dashboard_artifact_names = []
files = {}
for index, dashboard_src in enumerate(dashboard_sources):
dashboard_name = "grafana-dashboards-{0}".format(index)

dashboard_name = "dashboards-{0}".format(index)
dashboard_artifact_name = plan.upload_files(dashboard_src, name=dashboard_name)
dashboard_artifact_names.append(dashboard_artifact_name)

files[
"{0}/{1}".format(DASHBOARDS_DIRPATH_ON_SERVICE, dashboard_name)
] = dashboard_artifact_name

grr_commands += grr_push_dashboards(index)

Expand All @@ -146,11 +148,6 @@ def provision_dashboards(plan, service_url, dashboard_sources):
"GRAFANA_URL": service_url,
"DASHBOARDS_DIR": DASHBOARDS_DIRPATH_ON_SERVICE,
},
files={
"{0}/dashboards-{1}".format(
DASHBOARDS_DIRPATH_ON_SERVICE, i
): dashboard_artifact
for i, dashboard_artifact in enumerate(dashboard_artifact_names)
},
files=files,
run=util.join_cmds(grr_commands),
)

0 comments on commit b38742b

Please sign in to comment.