From 64feea3c39fba74094d8d2e84a46fd0b30ab6612 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Tue, 11 Dec 2018 17:39:16 +0100 Subject: [PATCH] remove filters --- camunda-overlay/camunda.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/camunda-overlay/camunda.py b/camunda-overlay/camunda.py index b9fa022..ae76619 100755 --- a/camunda-overlay/camunda.py +++ b/camunda-overlay/camunda.py @@ -54,6 +54,26 @@ def cleanup_users(keep = ["demo"]): except: pprint(res.content) +def get_filters(): + res = requests.get(CAMUNDA + "filter") + return res.json() + +def cleanup_filters(keep = ["All Tasks"]): + for filter in get_filters(): + # keep filter "All Tasks" + if filter['name'] in keep: + continue + + res = requests.delete(CAMUNDA + "filter/" + filter['id']) + if (res.status_code == 204): + print ("Cleaned up filter {}".format(filter['name'])) + else: + print ("Error cleaning filter {} ({}): Code: {}".format(filter['name'], filter['id'], res.status_code)) + try: + pprint(res.json()) + except: + pprint(res.content) + def create_deployment(cleanup=False): parameters = [ ("deployment-name", "sentiment-analysis"), @@ -129,6 +149,7 @@ if __name__ == "__main__": create_deployment(cleanup=args.cleanup) if args.cleanup: cleanup_users() + cleanup_filters() if args.autoclick >= 1: # start clicking -- 2.43.0