Fixing bug, cannot delete pools when members are empty

This patch is fixing the bug in which was problem to
delete pools without members. Instead deleting pools
kuryr-controller was restarting because of this.
More informations about this bug on:

Change-Id: If7e6066a75ddce9439649e7bf8b749efecfde1c6
Closes-Bug: #1920178
This commit is contained in:
scavnicka 2021-03-18 16:38:32 +00:00
parent 93a522e60f
commit 5ccf238ec2
1 changed files with 3 additions and 2 deletions

View File

@ -536,10 +536,11 @@ class KuryrLoadBalancerHandler(k8s_base.ResourceEventHandler):
removed_ids.add(pool['id'])
if removed_ids:
loadbalancer_crd['status']['pools'] = [p for p in loadbalancer_crd[
'status']['pools'] if p['id'] not in removed_ids]
'status'].get('pools', []) if p['id'] not in removed_ids]
loadbalancer_crd['status']['members'] = [m for m in
loadbalancer_crd[
'status']['members']
'status'].get(
'members', [])
if m['pool_id'] not in
removed_ids]