This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 2eb8a57108 AMBARI-25944: Update dashboard definition when dashboard version is changed (#3698) 2eb8a57108 is described below commit 2eb8a571083e220249d180aa0f88d9d513700d3e Author: Mohammad Arshad <ars...@apache.org> AuthorDate: Sat Jun 3 11:27:13 2023 +0530 AMBARI-25944: Update dashboard definition when dashboard version is changed (#3698) --- .../3.0.0/package/scripts/metrics_grafana_util.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/3.0.0/package/scripts/metrics_grafana_util.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/3.0.0/package/scripts/metrics_grafana_util.py index 4bd312d457..5be65103a6 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/3.0.0/package/scripts/metrics_grafana_util.py +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/3.0.0/package/scripts/metrics_grafana_util.py @@ -451,17 +451,27 @@ def create_ams_dashboards(): if "id" in dashboard_def: dashboard_def['id'] = None # Set correct tags + + dashboardVersion='-1' + if 'version' in dashboard_def: + dashboardVersion = str(dashboard_def['version']) + if 'tags' in dashboard_def: dashboard_def['tags'].append('builtin') dashboard_def['tags'].append(version) + dashboard_def['tags'].append(dashboardVersion) else: - dashboard_def['tags'] = [ 'builtin', version ] - + dashboard_def['tags'] = [ 'builtin', version, dashboardVersion ] for dashboard in existing_dashboards: if dashboard.title == dashboard_def['title']: if version not in dashboard.tags: - # Found existing dashboard with wrong version - update dashboard + # Found existing dashboard with wrong ambari version - update dashboard + update_def = True + elif dashboardVersion not in dashboard.tags: + # Found existing dashboard with wrong dashboard version - update dashboard update_def = True + Logger.info("Dashboard definition for %s with tags: %s will be updated as the dashboard version is changed to %s" % + (dashboard.title, dashboard.tags, dashboardVersion)) else: update_def = False # Skip update pass --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@ambari.apache.org For additional commands, e-mail: commits-h...@ambari.apache.org