Check host is not none in host aggregate page

Check that host is not none before trying to parse
the services that are up in each availability zone

Change-Id: I757f35ca2fa84da3441b544280c1c430bf3e8fb8
Closes-Bug: #1297920
(cherry picked from commit 7f30ab5124)
This commit is contained in:
Santiago Baldassin 2014-03-28 00:11:07 -03:00 committed by Adrien Cunin
parent 47e2406394
commit 306c5ca86c
1 changed files with 3 additions and 1 deletions

View File

@ -84,8 +84,10 @@ def get_available(zone):
def get_zone_hosts(zone):
hosts = zone.hosts
host_details = []
if hosts is None:
return []
for name, services in hosts.items():
up = all([s['active'] and s['available'] for k, s in services.items()])
up = all(s['active'] and s['available'] for s in services.values())
up = _("Services Up") if up else _("Services Down")
host_details.append("%(host)s (%(up)s)" % {'host': name, 'up': up})
return host_details