From 80d7f2a0e793efa38c0405fd3dd4b54b09b259d9 Mon Sep 17 00:00:00 2001 From: Waleed Date: Sun, 17 Jan 2021 11:38:34 +0200 Subject: [PATCH] sanity check for misconfigured gateways (#2265) --- jumpscale/sals/marketplace/deployer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jumpscale/sals/marketplace/deployer.py b/jumpscale/sals/marketplace/deployer.py index c2bb64ff42..eb0f5d8fb7 100644 --- a/jumpscale/sals/marketplace/deployer.py +++ b/jumpscale/sals/marketplace/deployer.py @@ -155,6 +155,14 @@ def _get_gateways_pools(self, farm_name, identity_name=None): farms_ids_with_gateways = [ gateway_farm.farm_id for gateway_farm in deployer._explorer.gateway.list() if gateway_farm.farm_id > 0 ] + # verify gateway farms is already there + for farm_id in farms_ids_with_gateways.copy(): + try: + deployer._explorer.farms.get(farm_id) + except: + j.logger.warning(f"farm {farm_id} doesn't exist anymore, skipping that gateway") + farms_ids_with_gateways.remove(farm_id) + farms_names_with_gateways = set( map(lambda farm_id: deployer._explorer.farms.get(farm_id=farm_id).name, farms_ids_with_gateways) )