Merge pull request #121 from scarabeusiv/master
Few bug fixes on the staging plugin
This commit is contained in:
commit
f1950c2637
@ -111,10 +111,7 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
elif cmd == 'accept':
|
elif cmd == 'accept':
|
||||||
return AcceptCommand(api).perform(api. prj_from_letter(args[1]))
|
return AcceptCommand(api).perform(api. prj_from_letter(args[1]))
|
||||||
elif cmd == 'unselect':
|
elif cmd == 'unselect':
|
||||||
for rq, rq_prj in RequestFinder.find_staged_sr(args[1:], opts.apiurl, api).items():
|
return UnselectCommand(api).perform(args[1:])
|
||||||
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')
|
|
||||||
elif cmd == 'select':
|
elif cmd == 'select':
|
||||||
tprj = api.prj_from_letter(args[1])
|
tprj = api.prj_from_letter(args[1])
|
||||||
return SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
return SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
||||||
|
@ -18,7 +18,7 @@ class CheckCommand(object):
|
|||||||
|
|
||||||
# If the project is empty just skip it
|
# If the project is empty just skip it
|
||||||
if not state:
|
if not state:
|
||||||
return
|
return None
|
||||||
|
|
||||||
print('Checking staging project: {}'.format(project))
|
print('Checking staging project: {}'.format(project))
|
||||||
if type(state) is list:
|
if type(state) is list:
|
||||||
@ -28,6 +28,8 @@ class CheckCommand(object):
|
|||||||
else:
|
else:
|
||||||
print(' ++ Acceptable staging project')
|
print(' ++ Acceptable staging project')
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def perform(self, project):
|
def perform(self, project):
|
||||||
"""
|
"""
|
||||||
Check one staging project verbosibly or all of them at once
|
Check one staging project verbosibly or all of them at once
|
||||||
@ -37,8 +39,8 @@ class CheckCommand(object):
|
|||||||
self._check_one_project(project, True)
|
self._check_one_project(project, True)
|
||||||
else:
|
else:
|
||||||
for project in self.api.get_staging_projects():
|
for project in self.api.get_staging_projects():
|
||||||
self._check_one_project(project, False)
|
if self._check_one_project(project, False):
|
||||||
# newline to split multiple prjs at once
|
# newline to split multiple prjs at once
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -100,7 +100,7 @@ class RequestFinder(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
query = 'states=new,review,declined&project=openSUSE:Factory&view=collection&package={}'
|
query = 'states=new,review,declined&project=openSUSE:Factory&view=collection&package={}'
|
||||||
query = query.format(package)
|
query = query.format(urllib2.quote(package))
|
||||||
url = makeurl(self.apiurl, ['request'], query)
|
url = makeurl(self.apiurl, ['request'], query)
|
||||||
f = http_GET(url)
|
f = http_GET(url)
|
||||||
|
|
||||||
|
@ -843,6 +843,10 @@ class StagingAPI(object):
|
|||||||
if by_group and i.by_group == by_group and i.state == 'new':
|
if by_group and i.by_group == by_group and i.state == 'new':
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# don't try to change reviews if the request is dead
|
||||||
|
if not req.state.name in ['new', 'review']:
|
||||||
|
return
|
||||||
|
|
||||||
query = {}
|
query = {}
|
||||||
if by_project:
|
if by_project:
|
||||||
query['by_project'] = 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