From 8194efced91a95b0a925b1a8d3b286ad4bfbf3d8 Mon Sep 17 00:00:00 2001 From: Patryk Gudalewicz Date: Fri, 28 Oct 2022 09:56:59 +0200 Subject: [PATCH] Adjusting env calls --- createDash.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) 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")