From de6940629aaf2cc494b5c0c788b1003b6a90eba3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 03 2018 15:05:57 +0000 Subject: Add a global configuration option to turn on or off fedmsg notifications This configuration key allow to turn on or off fedmsg notifications on the entire instance, not just for one project. Fixes https://pagure.io/pagure/issue/2717 Signed-off-by: Pierre-Yves Chibon --- diff --git a/doc/configuration.rst b/doc/configuration.rst index 8abc172..7b5d050 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -734,6 +734,15 @@ Defaults to: ``False``. This does not disable emails to the email address set in ``EMAIL_ERROR``. +FEDMSG_NOTIFICATIONS +~~~~~~~~~~~~~~~~~~~~ + +This configuration key allows to turn on or off notifications via `fedmsg +`_. + +Defaults to: ``True``. + + ALLOW_DELETE_BRANCH ~~~~~~~~~~~~~~~~~~~ diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 6165436..5867d68 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -40,6 +40,9 @@ if pagure_config['EVENTSOURCE_SOURCE']: def fedmsg_publish(*args, **kwargs): # pragma: no cover ''' Try to publish a message on the fedmsg bus. ''' + if not pagure_config.get('FEDMSG_NOTIFICATIONS', True): + return + # We catch Exception if we want :-p # pylint: disable=broad-except # Ignore message about fedmsg import