blob: 7be99acf0cb7c6e314deb4afaa34fc1961d73c39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import helpers
from config import render, db
class Repo(object):
def GET(self):
repo_count = db.query('select REPO,COUNT(DISTINCT IPKEY) AS PACKAGES,COUNT(DISTINCT UUID) AS HOSTS from INSTALLED_PACKAGES natural join REPOSITORIES group by REPO')
repo_data = dict()
for t in repo_count:
repo_data[t['REPO']] = {'HOSTS':t['HOSTS'], 'PACKAGES':t['PACKAGES']}
if helpers.is_json_request():
return helpers.serialize(repo_data)
else:
return render.repo(repo_data)
|