Pack log handlers with grains and mods

Refs #28999
This commit is contained in:
Mike Place 2015-11-19 13:07:30 -07:00
parent b1b6c8d416
commit b5a92a5fc3
3 changed files with 6 additions and 6 deletions

View File

@ -493,7 +493,7 @@ def search(opts, returners, whitelist=None):
)
def log_handlers(opts):
def log_handlers(opts, functions=None, grains=None):
'''
Returns the custom logging handler modules
@ -509,6 +509,7 @@ def log_handlers(opts):
),
opts,
tag='log_handlers',
pack={'__salt__': functions, '__grains__': grains}
)
return FilterDictWrapper(ret, '.setup_handlers')

View File

@ -93,8 +93,6 @@ except ImportError:
HAS_RAVEN = False
log = logging.getLogger(__name__)
__grains__ = {}
__salt__ = {}
# Define the module's virtual name
__virtualname__ = 'sentry'
@ -102,8 +100,6 @@ __virtualname__ = 'sentry'
def __virtual__():
if HAS_RAVEN is True:
__grains__ = salt.loader.grains(__opts__)
__salt__ = salt.loader.minion_mods(__opts__)
return __virtualname__
return False

View File

@ -678,7 +678,10 @@ def setup_extended_logging(opts):
initial_handlers = logging.root.handlers[:]
# Load any additional logging handlers
providers = salt.loader.log_handlers(opts)
# Pack the handlers with exec modules and grains
funcs = salt.loader.minion_mods(opts)
grains = salt.loader.grains(opts)
providers = salt.loader.log_handlers(opts, functions=funcs, grains=grains)
# Let's keep track of the new logging handlers so we can sync the stored
# log records with them