Split unselect from osc-staging.py to separate file and fix add_review to not bother with review if the sr is already dead. Fixes progress issue#1781.
This commit is contained in:
parent
ea8042869f
commit
9564484580
@ -111,10 +111,7 @@ def do_staging(self, subcmd, opts, *args):
|
||||
elif cmd == 'accept':
|
||||
return AcceptCommand(api).perform(api. prj_from_letter(args[1]))
|
||||
elif cmd == 'unselect':
|
||||
for rq, rq_prj in RequestFinder.find_staged_sr(args[1:], opts.apiurl, api).items():
|
||||
print('Unselecting "{}" from "{}"'.format(rq, rq_prj['staging']))
|
||||
api.rm_from_prj(rq_prj['staging'], request_id=rq)
|
||||
api.add_review(rq, by_group='factory-staging', msg='Please recheck')
|
||||
return UnselectCommand(api).perform(args[1:])
|
||||
elif cmd == 'select':
|
||||
tprj = api.prj_from_letter(args[1])
|
||||
return SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
||||
|
@ -594,7 +594,7 @@ class StagingAPI(object):
|
||||
filename = binary.get('filename', '')
|
||||
if filename.endswith('.iso'):
|
||||
break
|
||||
|
||||
|
||||
if not filename:
|
||||
return None
|
||||
|
||||
@ -613,7 +613,7 @@ class StagingAPI(object):
|
||||
bn = int(result.group(2)) * 100 + int(result.group(3))
|
||||
jobname += '.{}'.format(bn)
|
||||
jobname += "-minimalx"
|
||||
|
||||
|
||||
bestjob = None
|
||||
for job in jobs:
|
||||
if job['name'] == jobname and job['result'] != 'incomplete':
|
||||
@ -843,6 +843,10 @@ class StagingAPI(object):
|
||||
if by_group and i.by_group == by_group and i.state == 'new':
|
||||
return
|
||||
|
||||
# don't try to change reviews if the request is dead
|
||||
if not req.state.name in ['new', 'review']:
|
||||
return
|
||||
|
||||
query = {}
|
||||
if by_project:
|
||||
query['by_project'] = by_project
|
||||
|
21
osclib/unselect_command.py
Normal file
21
osclib/unselect_command.py
Normal file
@ -0,0 +1,21 @@
|
||||
from osc import oscerr
|
||||
from osc.core import http_GET
|
||||
|
||||
from osclib.request_finder import RequestFinder
|
||||
|
||||
|
||||
class UnselectCommand(object):
|
||||
|
||||
def __init__(self, api):
|
||||
self.api = api
|
||||
|
||||
def perform(self, packages):
|
||||
"""
|
||||
Remove request from staging project
|
||||
:param packages: packages/requests to delete from staging projects
|
||||
"""
|
||||
for request, request_project in RequestFinder.find_staged_sr(packages, opts.apiurl, api).items():
|
||||
staging_project = request_project['staging']
|
||||
print('Unselecting "{}" from "{}"'.format(request, staging_project))
|
||||
self.api.rm_from_prj(staging_project, request_id=request)
|
||||
self.api.add_review(request, by_group='factory-staging', msg='Please recheck')
|
Loading…
x
Reference in New Issue
Block a user