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
|
||||
|
||||
def check_adi_project(self, project):
|
||||
query_project = 'adi:' + project.split(':adi:')[1]
|
||||
query = {'format': 'json'}
|
||||
url = self.api.makeurl(('project', 'staging_projects', self.api.project,
|
||||
query_project), query=query)
|
||||
info = json.load(self.api.retried_GET(url))
|
||||
query_project = self.api.extract_staging_short(project)
|
||||
info = self.api.project_status(project, True)
|
||||
if len(info['building_repositories']):
|
||||
print query_project, "still building"
|
||||
return
|
||||
|
@ -108,14 +108,7 @@ class CheckCommand(object):
|
||||
"""
|
||||
report = []
|
||||
|
||||
query = {'format': 'json'}
|
||||
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))
|
||||
info = self.api.project_status(project, not project)
|
||||
if not project:
|
||||
for prj in info:
|
||||
if not prj['selected_requests']:
|
||||
|
@ -206,7 +206,8 @@ class StagingAPI(object):
|
||||
|
||||
packages_staged = {}
|
||||
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']:
|
||||
packages_staged[req['package']] = {'prj': prj, 'rq_id': req['id']}
|
||||
|
||||
@ -555,6 +556,8 @@ class StagingAPI(object):
|
||||
def load_prj_pseudometa(self, description_text):
|
||||
try:
|
||||
data = yaml.load(description_text)
|
||||
if data is None:
|
||||
data = {}
|
||||
except (TypeError, AttributeError):
|
||||
data = {}
|
||||
# make sure we have a requests field
|
||||
@ -816,11 +819,19 @@ class StagingAPI(object):
|
||||
|
||||
return log.getvalue()
|
||||
|
||||
def project_status(self, project):
|
||||
short = self.extract_staging_short(project)
|
||||
query = {'format': 'json'}
|
||||
url = self.makeurl(('project', 'staging_projects', self.project, short),
|
||||
query=query)
|
||||
@memoize(session=True)
|
||||
def project_status(self, staging=None, aggregate=False):
|
||||
path = ('project', 'staging_projects', self.project)
|
||||
if staging:
|
||||
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))
|
||||
|
||||
def check_project_status(self, project):
|
||||
|
@ -1751,5 +1751,164 @@
|
||||
],
|
||||
"subproject": null,
|
||||
"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