Merge pull request #762 from jberry-suse/project-status-aggregate
stagingapi: utilize aggregate backend call wherever possible.
This commit is contained in:
commit
331ec53e72
@ -14,11 +14,8 @@ class AdiCommand:
|
|||||||
self.api = api
|
self.api = api
|
||||||
|
|
||||||
def check_adi_project(self, project):
|
def check_adi_project(self, project):
|
||||||
query_project = 'adi:' + project.split(':adi:')[1]
|
query_project = self.api.extract_staging_short(project)
|
||||||
query = {'format': 'json'}
|
info = self.api.project_status(project, True)
|
||||||
url = self.api.makeurl(('project', 'staging_projects', self.api.project,
|
|
||||||
query_project), query=query)
|
|
||||||
info = json.load(self.api.retried_GET(url))
|
|
||||||
if len(info['building_repositories']):
|
if len(info['building_repositories']):
|
||||||
print query_project, "still building"
|
print query_project, "still building"
|
||||||
return
|
return
|
||||||
|
@ -108,14 +108,7 @@ class CheckCommand(object):
|
|||||||
"""
|
"""
|
||||||
report = []
|
report = []
|
||||||
|
|
||||||
query = {'format': 'json'}
|
info = self.api.project_status(project, not project)
|
||||||
if project:
|
|
||||||
url = self.api.makeurl(('project', 'staging_projects', self.api.project,
|
|
||||||
project), query=query)
|
|
||||||
else:
|
|
||||||
url = self.api.makeurl(('project', 'staging_projects', self.api.project),
|
|
||||||
query=query)
|
|
||||||
info = json.load(self.api.retried_GET(url))
|
|
||||||
if not project:
|
if not project:
|
||||||
for prj in info:
|
for prj in info:
|
||||||
if not prj['selected_requests']:
|
if not prj['selected_requests']:
|
||||||
|
@ -206,7 +206,8 @@ class StagingAPI(object):
|
|||||||
|
|
||||||
packages_staged = {}
|
packages_staged = {}
|
||||||
for prj in self.get_staging_projects():
|
for prj in self.get_staging_projects():
|
||||||
meta = self.get_prj_pseudometa(prj)
|
status = self.project_status(prj, True)
|
||||||
|
meta = self.load_prj_pseudometa(status['description'])
|
||||||
for req in meta['requests']:
|
for req in meta['requests']:
|
||||||
packages_staged[req['package']] = {'prj': prj, 'rq_id': req['id']}
|
packages_staged[req['package']] = {'prj': prj, 'rq_id': req['id']}
|
||||||
|
|
||||||
@ -555,6 +556,8 @@ class StagingAPI(object):
|
|||||||
def load_prj_pseudometa(self, description_text):
|
def load_prj_pseudometa(self, description_text):
|
||||||
try:
|
try:
|
||||||
data = yaml.load(description_text)
|
data = yaml.load(description_text)
|
||||||
|
if data is None:
|
||||||
|
data = {}
|
||||||
except (TypeError, AttributeError):
|
except (TypeError, AttributeError):
|
||||||
data = {}
|
data = {}
|
||||||
# make sure we have a requests field
|
# make sure we have a requests field
|
||||||
@ -816,11 +819,19 @@ class StagingAPI(object):
|
|||||||
|
|
||||||
return log.getvalue()
|
return log.getvalue()
|
||||||
|
|
||||||
def project_status(self, project):
|
@memoize(session=True)
|
||||||
short = self.extract_staging_short(project)
|
def project_status(self, staging=None, aggregate=False):
|
||||||
query = {'format': 'json'}
|
path = ('project', 'staging_projects', self.project)
|
||||||
url = self.makeurl(('project', 'staging_projects', self.project, short),
|
if staging:
|
||||||
query=query)
|
if aggregate:
|
||||||
|
full = self.prj_from_short(staging)
|
||||||
|
for status in self.project_status():
|
||||||
|
if status['name'] == full:
|
||||||
|
return status
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
path += (self.extract_staging_short(staging),)
|
||||||
|
url = self.makeurl(path, {'format': 'json'})
|
||||||
return json.load(self.retried_GET(url))
|
return json.load(self.retried_GET(url))
|
||||||
|
|
||||||
def check_project_status(self, project):
|
def check_project_status(self, project):
|
||||||
|
@ -1751,5 +1751,164 @@
|
|||||||
],
|
],
|
||||||
"subproject": null,
|
"subproject": null,
|
||||||
"untracked_requests": []
|
"untracked_requests": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"overall_state": "empty",
|
||||||
|
"selected_requests": [],
|
||||||
|
"broken_packages": [],
|
||||||
|
"building_repositories": [],
|
||||||
|
"description": "requests: []\n",
|
||||||
|
"missing_reviews": [],
|
||||||
|
"name": "openSUSE:Factory:Staging:U",
|
||||||
|
"obsolete_requests": [],
|
||||||
|
"openqa_jobs": [
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10521,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging-DVD-x86_64-Build107.2-cryptlvm",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10520,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging-DVD-x86_64-Build107.2-RAID1",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10519,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging-DVD-x86_64-Build107.2-minimalx",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subproject": {
|
||||||
|
"overall_state": "empty",
|
||||||
|
"selected_requests": [],
|
||||||
|
"broken_packages": [],
|
||||||
|
"building_repositories": [],
|
||||||
|
"description": "",
|
||||||
|
"missing_reviews": [],
|
||||||
|
"name": "openSUSE:Factory:Staging:U:DVD",
|
||||||
|
"obsolete_requests": [],
|
||||||
|
"openqa_jobs": [
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10524,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging2-DVD-x86_64-Build115.2-miniuefi",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10523,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging2-DVD-x86_64-Build115.2-gnome",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"clone_id": null,
|
||||||
|
"id": 10522,
|
||||||
|
"iso": null,
|
||||||
|
"name": "opensuse-Staging:B-Staging2-DVD-x86_64-Build115.2-kde",
|
||||||
|
"result": "passed",
|
||||||
|
"state": "done",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "isosize",
|
||||||
|
"result": "ok"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "livecdreboot",
|
||||||
|
"result": "na"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "first_boot",
|
||||||
|
"result": "ok"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subproject": null,
|
||||||
|
"untracked_requests": []
|
||||||
|
},
|
||||||
|
"untracked_requests": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user