commit 4a7347e39138c9e761a333c797c81f87eedd2d2c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Nov 7 18:00:41 2014 +0100
Fix unorphan action, it requires the new POC to be specified.
The new poc can be specified either with --user or with --poc, but one
of them should be there.
If it is not, raise an exception and inform the user about it.
pkgdb2client/cli.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index dd15a4c..d33cb80 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -297,9 +297,7 @@ def setup_parser():
parser_unorphan.add_argument(
'--poc', default=None,
help="FAS username of the new point of contact of the package "
- "This allows to give your package or an orphaned "
- "package to someone else. "
- "(default: current FAS user)")
+ "Can be skipped if --user is specified, otherwise is mandatory.")
parser_unorphan.set_defaults(func=do_unorphan)
## Request
@@ -598,6 +596,11 @@ def do_unorphan(args):
pkgdbclient.username = args.username
username = args.poc or args.username or pkgdbclient.username
+ if username is None:
+ raise argparse.ArgumentError(
+ args.poc,
+ 'You must specify either --user or --poc with the username of '
+ 'the new point of contact.')
LOG.info("new poc : {0}".format(username))
output = pkgdbclient.update_package_poc(pkgs, branches, username)
@@ -763,6 +766,10 @@ def main():
LOG.debug('ActionError')
print '{0}'.format(err.message)
return_code = 7
+ except argparse.ArgumentError, err:
+ LOG.debug('ArgparseError')
+ print '{0}'.format(err.message)
+ return_code = 9
except AppError, err:
LOG.debug('AppError')
print '{0}: {1}'.format(err.name, err.message)