Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(show-monitor): unset dashboard.id field for the restored dashboard #4144

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sdcm/monitorstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ def restore_sct_dashboards(monitoring_dockers_dir, scylla_version):
dashboard_url = f'http://localhost:{GRAFANA_DOCKER_PORT}/api/dashboards/db'
with open(sct_dashboard_file, "r") as f: # pylint: disable=invalid-name
dashboard_config = json.load(f)
# NOTE: remove value from the 'dashboard.id' field to avoid following error:
#
# Error message {"message":"Dashboard not found","status":"not-found"}
#
# Creating dashboard from scratch we should not have 'id', because Grafana will try
# to 'update' existing one which is absent in such a case.
if dashboard_config.get('dashboard', {}).get('id'):
dashboard_config['dashboard']['id'] = None

try:
res = requests.post(dashboard_url,
Expand Down