Make playbook and task in topic singular

The topic names need to be consistent between event types to ensure
people can properly use wildcards to filter the messages on just the
things they care about. However playbook and task were inconsistent in
topics from between different methods in the callback plugin. This
commit fixes that by making sure we always use 'playbook' and 'task',
not 'playbooks' or 'tasks'.

Change-Id: I3e6240560ad562e8f41f7e314ef7a4b0b1178e32
This commit is contained in:
Matthew Treinish 2017-04-28 20:10:49 -04:00
parent 0e58c2fd54
commit 1ef6088bb6
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177

View File

@ -156,7 +156,7 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_play_start(self, play):
self.playbook = play.name
self.uuid = str(play._uuid)
topic = 'playbooks/' + self.uuid + '/action/start'
topic = 'playbook/' + self.uuid + '/action/start'
msg = json.dumps({
'status': "OK",
'host': self.hostname,
@ -198,7 +198,7 @@ class CallbackModule(CallbackBase):
def v2_runner_on_ok(self, result, **kwargs):
host = result._host.get_name()
topic = 'playbooks/' + self.uuid + '/tasks/' + host + '/OK'
topic = 'playbook/' + self.uuid + '/task/' + host + '/OK'
data = {
'status': "OK",
'host': self.hostname,
@ -214,7 +214,7 @@ class CallbackModule(CallbackBase):
def v2_runner_on_failed(self, result, **kwargs):
host = result._host.get_name()
topic = 'playbooks/' + self.uuid + '/tasks/' + host + '/FAILED'
topic = 'playbook/' + self.uuid + '/task/' + host + '/FAILED'
self.errors += 1
data = {
'status': "FAILED",
@ -232,7 +232,7 @@ class CallbackModule(CallbackBase):
def v2_runner_on_unreachable(self, result):
host = result._host.get_name()
self.errors += 1
topic = 'playbooks/' + self.uuid + '/tasks/' + host + '/UNREACHABLE'
topic = 'playbook/' + self.uuid + '/task/' + host + '/UNREACHABLE'
data = {
'status': "UNREACHABLE",
'host': self.hostname,
@ -249,7 +249,7 @@ class CallbackModule(CallbackBase):
def v2_runner_on_async_failed(self, result):
host = result._host.get_name()
self.errors += 1
topic = 'playbooks/' + self.uuid + '/tasks/' + host + '/FAILED'
topic = 'playbook/' + self.uuid + '/task/' + host + '/FAILED'
data = {
'status': "FAILED",
'host': self.hostname,