Пример #1
0
 def get_all(self):
     # pylint:disable-msg=C0111,R0201
     hosts = get_all_hosts()
     result = []
     for host in hosts:
         result.append({
                 "id": host.idhost,
                 "href": tg.url("/api/v%s/hosts/%s" % (self.apiver, host.idhost)),
                 "name": host.name,
                 })
     return dict(hosts=result)
Пример #2
0
 def get_all(self):
     # pylint:disable-msg=C0111,R0201
     idhost = get_parent_id("hosts")
     if idhost is not None:
         hosts = [get_host(idhost)]
     else:
         hosts = get_all_hosts()
     result = []
     for host in hosts:
         for graph in host.graphs:
             result.append(
                 {
                     "id": graph.idgraph,
                     "href": tg.url("/api/v%s/graphs/%s" % (self.apiver, graph.idgraph)),
                     "name": graph.name,
                 }
             )
     return dict(graphs=result)