From cd103777ab98089478b6cfca10f7d609adb37aed Mon Sep 17 00:00:00 2001 From: Sergey Murashov Date: Tue, 11 Mar 2014 18:14:46 +0400 Subject: [PATCH] Add workaround for problems with RabbitMQ Sometimes script cannot delete vhost and return a 500 status code Change-Id: I8df789ee94bbc529fb0b15c036f11ceeab3af931 --- infra/RabbitMQ.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/infra/RabbitMQ.py b/infra/RabbitMQ.py index 0d1c649..f10c5d4 100644 --- a/infra/RabbitMQ.py +++ b/infra/RabbitMQ.py @@ -33,7 +33,12 @@ for queue in cl.get_queues(): for vhost_ in cl.get_all_vhosts(): if vhost_['name'] == vhost: - cl.delete_vhost(vhost_['name']) + while True: + try: + cl.delete_vhost(vhost_['name']) + break + except Exception: + pass for user_ in cl.get_users(): if user_['name'] == user: