virajjasani commented on code in PR #3698:
URL: https://github.com/apache/ambari/pull/3698#discussion_r1204874483
##########
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
Review Comment:
can it be simplified to this?
```
if version not in dashboard.tags or dashboardVersion not in dashboard.tags:
# Found existing dashboard with wrong ambari version or dashboard version
- update dashboard
update_def = True
else:
update_def = False # Skip update
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]