1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-02 09:46:16 +01:00

osc rdelete now warns, if requests are pending.

This commit is contained in:
Juergen Weigert 2011-03-05 20:08:47 +01:00
parent b2adcb7d94
commit e8aa7df530
2 changed files with 14 additions and 3 deletions

View File

@ -2533,7 +2533,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""${cmd_name}: Delete a project or packages on the server. """${cmd_name}: Delete a project or packages on the server.
As a safety measure, project must be empty (i.e., you need to delete all As a safety measure, project must be empty (i.e., you need to delete all
packages first). If you are sure that you want to remove this project and all packages first). Also, packages must have no requests pending (i.e., you need
to accept/revoke such requests first).
If you are sure that you want to remove this project and all
its packages use \'--force\' switch. its packages use \'--force\' switch.
usage: usage:
@ -2559,12 +2561,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not len(pkg): if not len(pkg):
raise oscerr.WrongArgs('Package argument is empty') raise oscerr.WrongArgs('Package argument is empty')
## FIXME: core.py:commitDelPackage() should have something similar
rlist = get_request_list(apiurl, prj, pkg)
for rq in rlist: print rq
if len(rlist) >= 1 and not opts.force:
print >>sys.stderr, 'Package has pending requests. Deleting the package will break them. '\
'They should be accepted/declined/revoked before deleting the package. '\
'Or just use \'--force\'.'
sys.exit(1)
delete_package(apiurl, prj, pkg) delete_package(apiurl, prj, pkg)
elif len(meta_get_packagelist(apiurl, prj)) >= 1 and not opts.force: elif len(meta_get_packagelist(apiurl, prj)) >= 1 and not opts.force:
print >>sys.stderr, 'Project contains packages. It must be empty before deleting it. ' \ print >>sys.stderr, 'Project contains packages. It must be empty before deleting it. ' \
'If you are sure that you want to remove this project and all its ' \ 'If you are sure that you want to remove this project and all its ' \
'packages use the \'--force\' switch' 'packages use the \'--force\' switch.'
sys.exit(1) sys.exit(1)
else: else:
delete_project(apiurl, prj) delete_project(apiurl, prj)

View File

@ -5888,7 +5888,7 @@ def check_filelist_before_commit(pacs):
else: else:
raise oscerr.UserAbort() raise oscerr.UserAbort()
def print_request_list(apiurl, project, package = None, states = ('new', ), force = False): def print_request_list(apiurl, project, package = None, states = ('new','review',), force = False):
""" """
prints list of pending requests for the specified project/package if "check_for_request_on_action" prints list of pending requests for the specified project/package if "check_for_request_on_action"
is enabled in the config or if "force" is set to True is enabled in the config or if "force" is set to True