From 677c741189e384a748a05a96a74cef1d395cc095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 1 Feb 2019 15:44:43 +0100 Subject: [PATCH] deleterequest for entire projects needs the --all option as additional protection We had it two times this week that people dropped entire projects (important ones) --- NEWS | 2 +- osc/commandline.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 86c4a66c..41e7a209 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ 0.165 - - + - deleterequest for entire projects needs the --all option as additional protection 0.164.1 - rewrite cpio handling to support python3 diff --git a/osc/commandline.py b/osc/commandline.py index acc2ca9f..222e7382 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1939,6 +1939,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. help='specify message TEXT') @cmdln.option('-r', '--repository', metavar='REPOSITORY', help='specify repository') + @cmdln.option('--all', action='store_true', + help='deletes entire project with packages inside') @cmdln.option('--accept-in-hours', metavar='HOURS', help='specify time when request shall get accepted automatically. Only works with write permissions in target.') @cmdln.alias("dr") @@ -1950,8 +1952,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. usage: osc deletereq [-m TEXT] # works in checked out project/package - osc deletereq [-m TEXT] PROJECT [PACKAGE] - osc deletereq [-m TEXT] PROJECT [--repository REPOSITORY] + osc deletereq [-m TEXT] PROJECT PACKAGE + osc deletereq [-m TEXT] PROJECT [--all|--repository REPOSITORY] ${cmd_option_list} """ import cgi @@ -1977,6 +1979,9 @@ Please submit there instead, or use --nodevelproject to force direct submission. else: raise oscerr.WrongArgs('Please specify at least a project.') + if (not opts.all) and package == None: + raise oscerr.WrongOptions('No package name has been provided. Use --all option, if you want to request to delete the entire project.') + if opts.repository: repository = opts.repository