diff --git a/createDash.py b/createDash.py index 316643e..8ec6927 100644 --- a/createDash.py +++ b/createDash.py @@ -106,21 +106,14 @@ def main(slo_path): print("Gather data, hold on a minute") DTTOKEN = config(token.get('env-token-name')) DTURL = url.get('env-url') - existingdashboards = get_all_dashboards_withname(DTTOKEN, DTURL,FULL_DASHBOARD_NAME) - if not args.environment: + if args.environment == item: + existingdashboards = get_all_dashboards_withname(DTTOKEN, DTURL,FULL_DASHBOARD_NAME) if not args.remove: - print("Uploading dashboard to Dynatrace...") + print("Uploading dashboard to Dynatrace ("+item+")...") create_or_update_dashboard(DTTOKEN, DTURL, existingdashboards, "kubernetes_tiles_template.json", FULL_DASHBOARD_NAME) + break else: remove_dashboards(DTTOKEN, DTURL, existingdashboards) - else: - if args.environment == item: - if not args.remove: - print("Uploading dashboard to Dynatrace ("+item+")...") - create_or_update_dashboard(DTTOKEN, DTURL, existingdashboards, "kubernetes_tiles_template.json", FULL_DASHBOARD_NAME) - break - else: - remove_dashboards(DTTOKEN, DTURL, existingdashboards) else: print("ERROR: No cluster specified")