- extend the plugin system with an event-based callback infrastructure

- implement callback hooks for task state transitions
 - example echo plugin that logs all callback invocations
This commit is contained in:
Mike Bonnet 2009-10-08 12:04:22 -04:00
parent f7d990f8d7
commit ae953a7072
5 changed files with 153 additions and 10 deletions

15
plugins/echo.py Normal file
View file

@ -0,0 +1,15 @@
# Example Koji callback
# Copyright (c) 2009 Red Hat, Inc.
# This callback simply logs all of its args using the logging module
#
# Authors:
# Mike Bonnet <mikeb@redhat.com>
from koji.plugin import callbacks, callback, ignore_error
import logging
@callback(*callbacks.keys())
@ignore_error
def echo(cbtype, *args, **kws):
logging.getLogger('koji.plugin.echo').info('Called the %s callback, args: %s; kws: %s',
cbtype, str(args), str(kws))