示例#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
示例#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
示例#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
示例#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
示例#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]
示例#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]