mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add Nose plugin for BeakerLib integration
The plugin hooks into the Nose runner and IPA's logging infrastructure and calls the appropriate BeakerLib functions (rl*). IPA's log_manager is extended to accept custom Handler classes. The ipa-run-tests helper now loads the plugin. Patr of the work for: https://fedorahosted.org/freeipa/ticket/3621
This commit is contained in:
committed by
Martin Kosek
parent
e87807d379
commit
780961a643
@@ -1006,6 +1006,9 @@ class LogManager(object):
|
||||
Specifies that a FileHandler be created, using the specified
|
||||
filename.
|
||||
|
||||
log_handler
|
||||
Specifies a custom logging.Handler to use
|
||||
|
||||
Common keys:
|
||||
------------
|
||||
|
||||
@@ -1140,8 +1143,10 @@ class LogManager(object):
|
||||
|
||||
# Iterate over handler configurations.
|
||||
for cfg in configs:
|
||||
# File or stream handler?
|
||||
# Type of handler?
|
||||
filename = cfg.get('filename')
|
||||
stream = cfg.get("stream")
|
||||
log_handler = cfg.get("log_handler")
|
||||
if filename:
|
||||
if cfg.has_key("stream"):
|
||||
raise ValueError("both filename and stream are specified, must be one or the other, config: %s" % cfg)
|
||||
@@ -1188,11 +1193,7 @@ class LogManager(object):
|
||||
permission = cfg.get('permission')
|
||||
if permission is not None:
|
||||
os.chmod(path, permission)
|
||||
else:
|
||||
stream = cfg.get("stream")
|
||||
if stream is None:
|
||||
raise ValueError("neither file nor stream specified in config: %s" % cfg)
|
||||
|
||||
elif stream:
|
||||
handler = logging.StreamHandler(stream)
|
||||
|
||||
# Set the handler name
|
||||
@@ -1200,6 +1201,12 @@ class LogManager(object):
|
||||
if name is None:
|
||||
name = 'stream:%s' % (stream)
|
||||
handler.name = name
|
||||
elif log_handler:
|
||||
handler = log_handler
|
||||
else:
|
||||
raise ValueError(
|
||||
"neither file nor stream nor log_handler specified in "
|
||||
"config: %s" % cfg)
|
||||
|
||||
# Add the handler
|
||||
handlers.append(handler)
|
||||
|
||||
Reference in New Issue
Block a user