Remove debug_message_collector plugin
Now that we have ARA, this plugin isn't that useful any longer. Closes-Bug: 1715996 Change-Id: Idcbf06a0c1df0f4a485da298dd0f4dd95311463b
This commit is contained in:
parent
ca0cf34163
commit
bfc26ac698
0
callback/.keep
Normal file
0
callback/.keep
Normal file
@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2016, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Callback for displaying debug messages after a playbook run."""
|
||||
from collections import OrderedDict
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
"""
|
||||
Callback plugin for collecting messages from debug tasks.
|
||||
|
||||
This plugin watches for debug tasks, collects the messages from those
|
||||
tasks, and displays them at the end of the playbook run.
|
||||
"""
|
||||
|
||||
# Ansible constants for the plugin
|
||||
CALLBACK_VERSION = 2.0
|
||||
CALLBACK_TYPE = 'aggregate'
|
||||
CALLBACK_NAME = 'debug_message_collector'
|
||||
CALLBACK_NEEDS_WHITELIST = False
|
||||
|
||||
def __init__(self):
|
||||
"""Constructor for the plugin class."""
|
||||
self.debug_tasks = OrderedDict()
|
||||
|
||||
def v2_runner_on_ok(self, result):
|
||||
"""
|
||||
Get details from debug tasks.
|
||||
|
||||
We only care about successful debug tasks. This function takes the
|
||||
debug message that is returned from the task and adds it into a
|
||||
dictionary of debug tasks. The message includes rendered template data
|
||||
if jinja2 templates were used to generate the debug output.
|
||||
"""
|
||||
if result._task.action == 'debug':
|
||||
self.debug_tasks[result._task._uuid] = {
|
||||
'name': result._task.name,
|
||||
'msg': result._result['msg'],
|
||||
}
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
"""
|
||||
Print debug tasks at the end of the playbook run.
|
||||
|
||||
Print all of the collected debug messages (if any exist) and display
|
||||
them at the end of the Ansible task output.
|
||||
"""
|
||||
if len(self.debug_tasks) > 0:
|
||||
print("DEBUG MESSAGE RECAP ".ljust(80, '*'))
|
||||
for uuid, task in self.debug_tasks.items():
|
||||
print("DEBUG: [{0}] ".format(task['name']).ljust(80, '*'))
|
||||
print("{0}\n".format(task['msg']))
|
@ -1,9 +0,0 @@
|
||||
=========
|
||||
Callbacks
|
||||
=========
|
||||
|
||||
Debug message collector
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This plugin watches for debug tasks, collects the messages from those tasks,
|
||||
and displays them at the end of the playbook run.
|
@ -6,7 +6,6 @@ OpenStack-Ansible plugins
|
||||
:maxdepth: 2
|
||||
|
||||
actions.rst
|
||||
callbacks.rst
|
||||
filters.rst
|
||||
lookups.rst
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user