From 8e25358260d178aeb67f0186cc33dfada03d63b5 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Fri, 25 Sep 2015 16:45:17 +0000 Subject: [PATCH] Make our fedmsg ansible callback resilient to failure. --- callback_plugins/fedmsg_callback.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/callback_plugins/fedmsg_callback.py b/callback_plugins/fedmsg_callback.py index 5dd5509089..8866b5f650 100644 --- a/callback_plugins/fedmsg_callback.py +++ b/callback_plugins/fedmsg_callback.py @@ -46,13 +46,19 @@ class CallbackModule(object): # It seems like recursive playbooks call this over and over again and # fedmsg doesn't like to be initialized more than once. So, here, just # catch that and ignore it. + failed = False try: fedmsg.init(**config) except ValueError: + import traceback + traceback.print_exc() + self.failed = True pass def playbook_on_play_start(self, pattern): + if self.failed: + return # This gets called once for each play.. but we just issue a message once # for the first one. One per "playbook" play = getattr(self, 'play', None) @@ -79,6 +85,8 @@ class CallbackModule(object): self.playbook_path = path def playbook_on_stats(self, stats): + if self.failed: + return if not self.playbook_path: return