From 43d3d0c83a38fb5a15d4553f6b3de2084321e1aa Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Dec 14 2018 15:27:59 +0000 Subject: Optionally listen to the message bus. --- diff --git a/fedmsg.d/sync2jira.py b/fedmsg.d/sync2jira.py index 730daaa..a1056a3 100644 --- a/fedmsg.d/sync2jira.py +++ b/fedmsg.d/sync2jira.py @@ -19,7 +19,13 @@ config = { 'sync2jira': { + # Scrape sources at startup 'initialize': True, + + # Listen on the message bus + 'listen': True, + + # Don't actually make changes to JIRA... 'testing': True, 'legacy_matching': False, diff --git a/sync2jira/main.py b/sync2jira/main.py index 0fd08dc..23c2248 100644 --- a/sync2jira/main.py +++ b/sync2jira/main.py @@ -75,10 +75,21 @@ def load_config(loader=fedmsg.config.load_config): if 'jira' not in config['sync2jira']: raise ValueError("No sync2jira.jira section found in fedmsg.d/ config") + # Provide some default values + defaults = { + 'listen': True, + } + for key, value in defaults.items(): + config['sync2jira'][key] = config['sync2jira'].get(key, value) + return config def listen(config): + if not config['sync2jira'].get('listen'): + log.info("`listen` is disabled. Exiting.") + return + log.info("Waiting for a relevant fedmsg message to arrive...") for _, _, topic, msg in fedmsg.tail_messages(**config): idx = msg['msg_id']