Fix bug when click into pool detail page

When click into pool detail page, there will cast error:
'Unable to retrieve health monitors'.
This patch fix the bug.

Change-Id: Iec58094603a8d36a2fd7fdd9116cda5f63b981be
This commit is contained in:
Qian Min Chen 2018-02-13 18:23:05 +08:00 committed by Allen
parent 633c04b2fc
commit 43cb1cd01f
1 changed files with 6 additions and 3 deletions

View File

@ -889,10 +889,13 @@ class HealthMonitors(generic.View):
)
)
if pool_id:
pool = _get_sdk_object_dict(conn.load_balancer.find_pool(pool_id))
health_monitor_list = self._filter_health_monitors(
health_monitor_list,
pool_id)
pool)
return {'items': health_monitor_list}
@rest_utils.ajax()
@ -904,11 +907,11 @@ class HealthMonitors(generic.View):
'pool_id': request.DATA.get('parentResourceId')}
return create_health_monitor(request, **kwargs)
def _filter_health_monitors(self, health_monitor_list, pool_id):
def _filter_health_monitors(self, health_monitor_list, pool):
filtered_health_monitors = []
for health_monitor in health_monitor_list:
if health_monitor['pools'][0]['id'] == pool_id:
if health_monitor['id'] == pool['health_monitor_id']:
filtered_health_monitors.append(health_monitor)
return filtered_health_monitors