make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
This commit is contained in:
parent
54e821ca94
commit
c267c23020
10 changed files with 13 additions and 3 deletions
|
@ -150,12 +150,13 @@ class TaskQueueManager:
|
||||||
# the name of the current plugin and type to see if we need to skip
|
# the name of the current plugin and type to see if we need to skip
|
||||||
# loading this callback plugin
|
# loading this callback plugin
|
||||||
callback_type = getattr(callback_plugin, 'CALLBACK_TYPE', None)
|
callback_type = getattr(callback_plugin, 'CALLBACK_TYPE', None)
|
||||||
|
callback_needs_whitelist = getattr(callback_plugin, 'CALLBACK_NEEDS_WHITELIST', False)
|
||||||
(callback_name, _) = os.path.splitext(os.path.basename(callback_plugin._original_path))
|
(callback_name, _) = os.path.splitext(os.path.basename(callback_plugin._original_path))
|
||||||
if callback_type == 'stdout':
|
if callback_type == 'stdout':
|
||||||
if callback_name != self._stdout_callback or stdout_callback_loaded:
|
if callback_name != self._stdout_callback or stdout_callback_loaded:
|
||||||
continue
|
continue
|
||||||
stdout_callback_loaded = True
|
stdout_callback_loaded = True
|
||||||
elif C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST:
|
elif callback_needs_whitelist and (C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self._callback_plugins.append(callback_plugin(self._display))
|
self._callback_plugins.append(callback_plugin(self._display))
|
||||||
|
|
|
@ -28,7 +28,8 @@ class CallbackModule(CallbackBase):
|
||||||
"""
|
"""
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
CALLBACK_TYPE = 'context_demo'
|
CALLBACK_NAME = 'context_demo'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def v2_on_any(self, *args, **kwargs):
|
def v2_on_any(self, *args, **kwargs):
|
||||||
i = 0
|
i = 0
|
||||||
|
|
|
@ -46,8 +46,9 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_TYPE = 'notification'
|
||||||
CALLBACK_NAME = 'hipchat'
|
CALLBACK_NAME = 'hipchat'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'notification'
|
CALLBACK_TYPE = 'notification'
|
||||||
CALLBACK_NAME = 'log_plays'
|
CALLBACK_NAME = 'log_plays'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
TIME_FORMAT="%b %d %Y %H:%M:%S"
|
TIME_FORMAT="%b %d %Y %H:%M:%S"
|
||||||
MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n"
|
MSG_FORMAT="%(now)s - %(category)s - %(data)s\n\n"
|
||||||
|
|
|
@ -74,6 +74,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'notification'
|
CALLBACK_TYPE = 'notification'
|
||||||
CALLBACK_NAME = 'mail'
|
CALLBACK_NAME = 'mail'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def v2_runner_on_failed(self, res, ignore_errors=False):
|
def v2_runner_on_failed(self, res, ignore_errors=False):
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'notification'
|
CALLBACK_TYPE = 'notification'
|
||||||
CALLBACK_NAME = 'osx_say'
|
CALLBACK_NAME = 'osx_say'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
CALLBACK_NAME = 'profile_tasks'
|
CALLBACK_NAME = 'profile_tasks'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
self.stats = {}
|
self.stats = {}
|
||||||
|
|
|
@ -26,6 +26,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
CALLBACK_NAME = 'syslog_json'
|
CALLBACK_NAME = 'syslog_json'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
CALLBACK_NAME = 'timer'
|
CALLBACK_NAME = 'timer'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ class CallbackModule(CallbackBase):
|
||||||
CALLBACK_VERSION = 2.0
|
CALLBACK_VERSION = 2.0
|
||||||
CALLBACK_TYPE = 'aggregate'
|
CALLBACK_TYPE = 'aggregate'
|
||||||
CALLBACK_NAME = 'tree'
|
CALLBACK_NAME = 'tree'
|
||||||
|
CALLBACK_NEEDS_WHITELIST = True
|
||||||
|
|
||||||
def __init__(self, display):
|
def __init__(self, display):
|
||||||
super(CallbackModule, self).__init__(display)
|
super(CallbackModule, self).__init__(display)
|
||||||
|
|
Loading…
Reference in a new issue