def destroy(vhost): rabbit_manager.delete_vhost(vhost) # make sure connections for this vhost are also destroyed. vhost_pools = [ pool for key, pool in list(connections.items()) if isinstance(key, Iterable) and key[4] == vhost ] for pool in vhost_pools: pool.force_close_all()