diff --git a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py index 86c2fc468dfc78fb6e98f9fb9c35fbe2664db134..c19ba7114c9d5a0112d4df6f21f9b7fd32f49bf9 100755 --- a/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py +++ b/magma/hackfest_magma-agw-enb_vnfd/charms/magmagw/src/charm.py @@ -173,11 +173,20 @@ class SimpleHAProxyCharm(CharmBase): orch_ip = event.params["orch_ip"] orch_net = event.params["orch_net"] proxy = self.get_ssh_proxy() - stdout, stderr = proxy.run( - "/home/magma/addnet.py --orch_ip {} --orch_net {}".format( - orch_ip, orch_net - ) - ) + + attempt = 0 + while attempt < 50: + try: + stdout, stderr = proxy.run( + "/home/magma/addnet.py --orch_ip {} --orch_net {}".format( + orch_ip, orch_net + ) + ) + break + except subprocess.CalledProcessError: + attempt += 1 + import time + time.sleep(5) event.set_results({"output": stdout, "stderr": stderr}) else: event.fail("Unit is not leader")