Make our fedmsg ansible callback resilient to failure.
This commit is contained in:
parent
e3f5a2bc15
commit
8e25358260
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue