Fix neutron lbaas v2 when no listeners are set

During configuration step we can receive data with no listeners yet.
Just skip them.

Closes-bug: #1700464
Change-Id: Ie29be49304ebe56e6a7dcdf7487bde423c227112
This commit is contained in:
Mehdi Abaakouk 2017-07-25 08:41:58 +02:00
parent 5a08978e61
commit 6415640f2f

View File

@ -186,7 +186,11 @@ class Client(object):
pools = self.client.list_lbaas_pools().get('pools')
for pool in pools:
pool_id = pool.get('id')
listener_id = pool.get('listeners')[0].get('id')
listeners = pool.get('listeners')
if not listeners:
continue
# NOTE(sileht): Can we have more than 1 listener
listener_id = listeners[0].get('id')
lb_id = self._get_loadbalancer_id_with_listener_id(listener_id)
status = self._get_member_status(lb_id, [listener_id, pool_id])
resp = self.client.list_lbaas_members(pool_id)