repair: support the --cleanup flag to include all untracked requests.
This commit is contained in:
parent
94a4629d2c
commit
37ce041b9d
@ -155,6 +155,8 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
"repair" will attempt to repair the state of a request that has been
|
"repair" will attempt to repair the state of a request that has been
|
||||||
corrupted.
|
corrupted.
|
||||||
|
|
||||||
|
Use the --cleanup flag to include all untracked requests.
|
||||||
|
|
||||||
"select" will add requests to the project
|
"select" will add requests to the project
|
||||||
Stagings are expected to be either in short-hand or the full project
|
Stagings are expected to be either in short-hand or the full project
|
||||||
name. For example letter or named stagings can be specified simply as
|
name. For example letter or named stagings can be specified simply as
|
||||||
@ -239,7 +241,7 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
osc staging unselect [--cleanup] [-m MESSAGE] [REQUEST...]
|
osc staging unselect [--cleanup] [-m MESSAGE] [REQUEST...]
|
||||||
osc staging unlock
|
osc staging unlock
|
||||||
osc staging rebuild [--force] [STAGING...]
|
osc staging rebuild [--force] [STAGING...]
|
||||||
osc staging repair REQUEST...
|
osc staging repair [--cleanup] [REQUEST...]
|
||||||
osc staging setprio [STAGING...]
|
osc staging setprio [STAGING...]
|
||||||
"""
|
"""
|
||||||
if opts.version:
|
if opts.version:
|
||||||
@ -249,8 +251,10 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
raise oscerr.WrongArgs('No command given, see "osc help staging"!')
|
raise oscerr.WrongArgs('No command given, see "osc help staging"!')
|
||||||
cmd = args[0]
|
cmd = args[0]
|
||||||
if cmd in ('freeze', 'repair'):
|
if cmd == 'freeze':
|
||||||
min_args, max_args = 1, None
|
min_args, max_args = 1, None
|
||||||
|
elif cmd == 'repair':
|
||||||
|
min_args, max_args = 0, None
|
||||||
elif cmd == 'frozenage':
|
elif cmd == 'frozenage':
|
||||||
min_args, max_args = 0, None
|
min_args, max_args = 0, None
|
||||||
elif cmd == 'setprio':
|
elif cmd == 'setprio':
|
||||||
@ -496,6 +500,6 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
elif cmd == 'rebuild':
|
elif cmd == 'rebuild':
|
||||||
RebuildCommand(api).perform(args[1:], opts.force)
|
RebuildCommand(api).perform(args[1:], opts.force)
|
||||||
elif cmd == 'repair':
|
elif cmd == 'repair':
|
||||||
RepairCommand(api).perform(args[1:])
|
RepairCommand(api).perform(args[1:], opts.cleanup)
|
||||||
elif cmd == 'setprio':
|
elif cmd == 'setprio':
|
||||||
PrioCommand(api).perform(args[1:])
|
PrioCommand(api).perform(args[1:])
|
||||||
|
@ -57,11 +57,17 @@ class RepairCommand(object):
|
|||||||
change_review_state(self.api.apiurl, reqid, newstate='accepted', message='Re-evaluation needed', by_project=staging_project)
|
change_review_state(self.api.apiurl, reqid, newstate='accepted', message='Re-evaluation needed', by_project=staging_project)
|
||||||
self.api.add_review(reqid, by_group=self.api.cstaging_group, msg='Requesting new staging review')
|
self.api.add_review(reqid, by_group=self.api.cstaging_group, msg='Requesting new staging review')
|
||||||
|
|
||||||
def perform(self, packages):
|
def perform(self, packages, cleanup=False):
|
||||||
"""
|
"""
|
||||||
Repair request in staging project or move it out
|
Repair request in staging project or move it out
|
||||||
:param packages: packages/requests to repair in staging projects
|
:param packages: packages/requests to repair in staging projects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if cleanup:
|
||||||
|
untracked = self.api.project_status_requests('untracked')
|
||||||
|
if len(untracked) > 0:
|
||||||
|
print('Cleanup {} untracked requests'.format(len(untracked)))
|
||||||
|
packages += tuple(untracked)
|
||||||
|
|
||||||
for reqid in RequestFinder.find_sr(packages, self.api):
|
for reqid in RequestFinder.find_sr(packages, self.api):
|
||||||
self.repair(reqid)
|
self.repair(reqid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user