Debug fedmsg callback_plugin.
This commit is contained in:
parent
2d3bd45979
commit
09b268e69c
1 changed files with 7 additions and 5 deletions
|
@ -34,7 +34,7 @@ def getlogin():
|
||||||
class CallbackModule(object):
|
class CallbackModule(object):
|
||||||
""" Publish playbook starts and stops to fedmsg. """
|
""" Publish playbook starts and stops to fedmsg. """
|
||||||
|
|
||||||
playbook = None
|
playbook_path = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
config = fedmsg.config.load_config()
|
config = fedmsg.config.load_config()
|
||||||
|
@ -57,7 +57,7 @@ class CallbackModule(object):
|
||||||
if play.playbook.check:
|
if play.playbook.check:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.playbook:
|
if not self.playbook_path:
|
||||||
fedmsg.publish(
|
fedmsg.publish(
|
||||||
modname="ansible", topic="playbook.start",
|
modname="ansible", topic="playbook.start",
|
||||||
msg=dict(
|
msg=dict(
|
||||||
|
@ -69,17 +69,19 @@ class CallbackModule(object):
|
||||||
check=play.playbook.check,
|
check=play.playbook.check,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.playbook = path
|
self.playbook_path = path
|
||||||
|
|
||||||
def playbook_on_stats(self, stats):
|
def playbook_on_stats(self, stats):
|
||||||
if not self.playbook:
|
if not self.playbook_path:
|
||||||
return
|
return
|
||||||
|
|
||||||
results = dict([(h, stats.summarize(h)) for h in stats.processed])
|
results = dict([(h, stats.summarize(h)) for h in stats.processed])
|
||||||
|
import pprint
|
||||||
|
pprint.pprint(results)
|
||||||
fedmsg.publish(
|
fedmsg.publish(
|
||||||
modname="ansible", topic="playbook.complete",
|
modname="ansible", topic="playbook.complete",
|
||||||
msg=dict(
|
msg=dict(
|
||||||
playbook=self.playbook,
|
playbook=self.playbook_path,
|
||||||
userid=getlogin(),
|
userid=getlogin(),
|
||||||
results=results,
|
results=results,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue