commit 4fc79b546a1b46148a1f0d99fb8516e0a30da265
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 9 11:56:28 2015 +0200
Add a koschei action to pkgdb-cli
This action can be used to either retrieve the current koschei monitoring
status of a package, or update it to the specified status.
pkgdb2client/cli.py | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 12bb172..4ce3ac4 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -397,6 +397,19 @@ def setup_parser():
"(can be: 0, 1, nobuild)")
parser_monitoring.set_defaults(func=do_monitoring)
+ ## Koschei Monitoring
+ parser_koschei = subparsers.add_parser(
+ 'koschei',
+ help='Get or Set the koschei monitoring of a package')
+ parser_koschei.add_argument(
+ 'package', help="Name of the package")
+ parser_koschei.add_argument(
+ 'koschei', default=None, nargs="?",
+ help="Koschei monitoring status to set the package to, "
+ "if not specified will show the current koschei monitoring status, "
+ "otherwise will update it. (can be: false, 0, true, 1)")
+ parser_koschei.set_defaults(func=do_koschei)
+
return parser
@@ -797,6 +810,26 @@ def do_monitoring(args):
'messages', 'Invalid output returned, please contact an
admin')
+def do_koschei(args):
+ ''' Retrieve or set the koschei monitoring status of a package from
+ pkgdb.
+
+ '''
+ LOG.info("package : {0}".format(args.package))
+ LOG.info("koschei : {0}".format(args.koschei))
+
+ if not args.koschei:
+ pkg = pkgdbclient.get_package(
+ args.package, branches='master', acls=False
+ )['packages'][0]['package']
+ print "Current koschei monitoring status of {0} is: {1}".format(
+ pkg['name'], pkg['koschei_monitor'])
+ else:
+ output = pkgdbclient.set_koschei_status(args.package, args.koschei)
+ print output.get(
+ 'messages', 'Invalid output returned, please contact an
admin')
+
+
def main():
''' Main function '''
# Set up parser for global args
Show replies by date