Optimize request_id_for_package
This commit is contained in:
parent
b91cc995dd
commit
26772ff058
@ -158,19 +158,22 @@ class RequestFinder(object):
|
||||
This function is only called for its side effect.
|
||||
"""
|
||||
|
||||
url = self.api.makeurl(['staging', self.api.project, 'staging_projects'], { 'requests': 1 })
|
||||
status = ET.parse(self.api.retried_GET(url)).getroot()
|
||||
|
||||
for p in pkgs:
|
||||
found = False
|
||||
for staging in self.api.get_staging_projects():
|
||||
if _is_int(p) and self.api.get_package_for_request_id(staging, p):
|
||||
self.srs[int(p)] = {'staging': staging}
|
||||
for staging in status.findall('staging_project'):
|
||||
if _is_int(p) and self.api.get_package_for_request_id(staging.get('name'), p):
|
||||
self.srs[int(p)] = {'staging': staging.get('name')}
|
||||
found = True
|
||||
break
|
||||
else:
|
||||
rq = self.api.get_request_id_for_package(staging, p)
|
||||
if rq:
|
||||
self.srs[rq] = {'staging': staging}
|
||||
found = True
|
||||
break
|
||||
for request in staging.findall('staged_requests/request'):
|
||||
if request.get('package') == p:
|
||||
self.srs[int(request.get('id'))] = {'staging': staging.get('name')}
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
raise oscerr.WrongArgs('No SR# found for: {}'.format(p))
|
||||
|
||||
|
@ -647,7 +647,6 @@ class StagingAPI(object):
|
||||
:param project: project the package is in
|
||||
:param package: package we want to query for
|
||||
"""
|
||||
logging.error('get_request_id_for_package')
|
||||
data = self.project_status(project, status=False)
|
||||
for x in data.findall('staged_requests/request'):
|
||||
if x.get('package') == package:
|
||||
|
Loading…
x
Reference in New Issue
Block a user