accept other new requests after accepting staging prjs
This commit is contained in:
parent
25f55609d4
commit
454828d252
@ -80,7 +80,7 @@ def do_staging(self, subcmd, opts, *args):
|
||||
raise oscerr.WrongArgs('No command given, see "osc help staging"!')
|
||||
cmd = args[0]
|
||||
if cmd in ('accept', 'freeze'):
|
||||
min_args, max_args = 1, 1
|
||||
min_args, max_args = 1, None
|
||||
elif cmd == 'check':
|
||||
min_args, max_args = 0, 2
|
||||
elif cmd == 'select':
|
||||
@ -111,7 +111,10 @@ def do_staging(self, subcmd, opts, *args):
|
||||
for prj in args[1:]:
|
||||
FreezeCommand(api).perform(api.prj_from_letter(prj))
|
||||
elif cmd == 'accept':
|
||||
AcceptCommand(api).perform(api.prj_from_letter(args[1]))
|
||||
cmd = AcceptCommand(api)
|
||||
for prj in args[1:]:
|
||||
cmd.perform(api.prj_from_letter(prj))
|
||||
cmd.accept_other_new()
|
||||
elif cmd == 'unselect':
|
||||
UnselectCommand(api).perform(args[1:])
|
||||
elif cmd == 'select':
|
||||
|
@ -1,21 +1,37 @@
|
||||
from osc.core import change_request_state
|
||||
from osc.core import get_request
|
||||
from osc.core import http_GET
|
||||
|
||||
from osclib.comments import CommentAPI
|
||||
|
||||
from xml.etree import cElementTree as ET
|
||||
|
||||
class AcceptCommand(object):
|
||||
def __init__(self, api):
|
||||
self.api = api
|
||||
self.comment = CommentAPI(self.api.apiurl)
|
||||
|
||||
def find_new_requests(self, project):
|
||||
requests = []
|
||||
|
||||
query = "match=state/@name='new'+and+(action/target/@project='{}'+and+action/@type='submit')".format(project)
|
||||
url = self.api.makeurl(['search', 'request'], query)
|
||||
|
||||
f = http_GET(url)
|
||||
root = ET.parse(f).getroot()
|
||||
|
||||
ids=[]
|
||||
for rq in root.findall('request'):
|
||||
ids.append(int(rq.get('id')))
|
||||
return ids
|
||||
|
||||
def perform(self, project):
|
||||
"""
|
||||
Accept the staging LETTER for review and submit to factory
|
||||
Then disable the build to disabled
|
||||
:param project: staging project we are working with
|
||||
"""
|
||||
|
||||
|
||||
status = self.api.check_project_status(project)
|
||||
|
||||
if not status:
|
||||
@ -45,3 +61,10 @@ class AcceptCommand(object):
|
||||
if self.api.project_exists(project + ":DVD"):
|
||||
self.api.build_switch_prj(project + ":DVD", 'disable')
|
||||
|
||||
return True
|
||||
|
||||
def accept_other_new(self):
|
||||
for req in self.find_new_requests('openSUSE:Factory'):
|
||||
change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory')
|
||||
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user