Exemplo n.º 1
0
 def all_host_dict(cls):
     rows = db.query_all('SELECT id, hostname FROM host')
     ret = {}
     if rows:
         for row in rows:
             ret[row[0]] = row[1]
     return ret
Exemplo n.º 2
0
 def all_host_dict(cls):
     rows = db.query_all('SELECT id, hostname FROM host')
     ret = {}
     if rows:
         for row in rows:
             ret[row[0]] = row[1]
     return ret
Exemplo n.º 3
0
 def all_set(cls):
     sql = 'select id, grp_name from %s' % cls._tbl
     rows = db.query_all(sql)
     name_set = dict()
     name_id = dict()
     for row in rows:
         name = row[1]
         name_set[name] = set(name.split('_'))
         name_id[name] = row[0]
     return name_set, name_id
Exemplo n.º 4
0
 def all_set(cls):
     sql = 'select id, grp_name from %s' % cls._tbl
     rows = db.query_all(sql)
     name_set = dict()
     name_id = dict()
     for row in rows:
         name = row[1]
         name_set[name] = set(name.split('_'))
         name_id[name] = row[0]
     return name_set, name_id
Exemplo n.º 5
0
 def all_group_dict(cls):
     rows = db.query_all('select id, grp_name from grp where come_from = 0')
     return [{'id': row[0], 'name': row[1]} for row in rows]
Exemplo n.º 6
0
 def all_group_dict(cls):
     rows = db.query_all('select id, grp_name from grp where come_from = 0')
     return [{'id': row[0], 'name': row[1]} for row in rows]