Adjusting env calls

master
Patryk Gudalewicz 2022-10-28 09:56:59 +02:00
parent cd050a201f
commit 8194efced9
1 changed files with 4 additions and 11 deletions

View File

@ -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")