From a0dc776f56c9060ac5cdf4eceea3c4f0e28d45a1 Mon Sep 17 00:00:00 2001 From: Tim Rupp Date: Thu, 7 Dec 2017 08:47:35 -0800 Subject: [PATCH] Fixes a weird udf scenario (#33681) The situation happened where in udf it stopped provisioning correctly. Seems like the best resolution is to restart asm. --- .../modules/network/f5/bigip_provision.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/f5/bigip_provision.py b/lib/ansible/modules/network/f5/bigip_provision.py index be8f37cfbc..be9fc9d67e 100644 --- a/lib/ansible/modules/network/f5/bigip_provision.py +++ b/lib/ansible/modules/network/f5/bigip_provision.py @@ -344,6 +344,7 @@ class ModuleManager(object): :return: """ nops = 0 + restarted_asm = False while nops < 3: try: policies = self.client.api.tm.asm.policies_s.get_collection() @@ -352,9 +353,23 @@ class ModuleManager(object): else: nops = 0 except Exception as ex: - pass + if not restarted_asm: + self._restart_asm() + restarted_asm = True time.sleep(5) + def _restart_asm(self): + try: + self.client.api.tm.util.bash.exec_cmd( + 'run', + utilCmdArgs='-c "bigstart restart asm"' + ) + time.sleep(60) + return True + except Exception: + pass + return None + def _get_last_reboot(self): try: output = self.client.api.tm.util.bash.exec_cmd(