diff --git a/octavia_f5/controller/worker/tasks/f5_tasks.py b/octavia_f5/controller/worker/tasks/f5_tasks.py index 48ec198..a045a5e 100644 --- a/octavia_f5/controller/worker/tasks/f5_tasks.py +++ b/octavia_f5/controller/worker/tasks/f5_tasks.py @@ -438,6 +438,12 @@ def revert(self, bigip: bigip_restclient.BigIPRestClient, f"was run: {subnet_route_name}") return + # don't restore subnet route if it wasn't removed + res = bigip.get(path=f"/mgmt/tm/net/route/~Common~{subnet_route_name}") + if res.status_code != 404: + LOG.warning(f"Reverting RemoveSubnetRoute: Subnet route {subnet_route_name} was not removed, no need to restore") + return + # restore subnet route payload = {'name': subnet_route_name, 'tmInterface': subnet_route['tmInterface'], @@ -468,6 +474,12 @@ def revert(self, bigip: bigip_restclient.BigIPRestClient, f"was run: {selfip['name']}") return + # don't restore SelfIP if it wasn't removed + res = bigip.get(path=f"/mgmt/tm/net/self/{selfip['port_id']}") + if res.status_code != 404: + LOG.warning(f"Reverting RemoveSelfIP: SelfIP {selfip['name']} was not removed, no need to restore") + return + # restore SelfIP payload = {'name': selfip['name'], 'vlan': selfip['vlan'], 'address': selfip['address']} LOG.warning(f"Reverting RemoveSelfIP: Restoring SelfIP: {selfip['name']}")