From 1ef6088bb6678b78993672ffdec93c7c99a0405d Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 28 Apr 2017 20:10:49 -0400 Subject: [PATCH] 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 --- modules/openstack_project/files/puppetmaster/mqtt.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openstack_project/files/puppetmaster/mqtt.py b/modules/openstack_project/files/puppetmaster/mqtt.py index d55228fcc8..307ed9573c 100644 --- a/modules/openstack_project/files/puppetmaster/mqtt.py +++ b/modules/openstack_project/files/puppetmaster/mqtt.py @@ -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,