sort hosts by pretty name, not by internal hostname
This commit is contained in:
parent
6b95291821
commit
a0a359d5dd
1 changed files with 6 additions and 4 deletions
10
service.py
10
service.py
|
@ -107,13 +107,15 @@ class StatusPage:
|
|||
|
||||
def render_service_details(self):
|
||||
# generate list of hosts by scanning services for unique host_name
|
||||
host_names = set()
|
||||
host_names = {}
|
||||
for service in self.get_api_result():
|
||||
host_names.add(service['attrs']['host_name'])
|
||||
host_names[service['joins']['host']['vars']['pretty_name']] = service['attrs']['host_name']
|
||||
|
||||
# render html for each host_name
|
||||
html_output = []
|
||||
for host in sorted(host_names):
|
||||
html_output.append(self.render_services_per_host(host))
|
||||
# Can't use .values() here, since we want to sort by prettyname
|
||||
for prettyname, hostname in sorted(host_names.items()):
|
||||
html_output.append(self.render_services_per_host(hostname))
|
||||
|
||||
return ''.join(html_output)
|
||||
|
||||
|
|
Loading…
Reference in a new issue