summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Server')
-rw-r--r--src/lib/Bcfg2/Server/Lint/__init__.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py
index 3a86709c0..f3991e3fc 100644
--- a/src/lib/Bcfg2/Server/Lint/__init__.py
+++ b/src/lib/Bcfg2/Server/Lint/__init__.py
@@ -96,7 +96,6 @@ class Plugin (object):
class ErrorHandler (object):
- # how to handle different errors by default
def __init__(self, config=None):
self.errors = 0
self.warnings = 0
@@ -105,11 +104,12 @@ class ErrorHandler (object):
termsize = get_termsize()
if termsize is not None:
- self._wrapper = textwrap.TextWrapper(initial_indent=" ",
- subsequent_indent=" ",
- width=termsize[0])
+ twrap = textwrap.TextWrapper(initial_indent=" ",
+ subsequent_indent=" ",
+ width=termsize[0])
+ self._wrapper = twrap.wrap
else:
- self._wrapper = None
+ self._wrapper = lambda s: [s]
self._handlers = {}
if config is not None:
@@ -166,13 +166,10 @@ class ErrorHandler (object):
rawlines = msg.splitlines()
firstline = True
for rawline in rawlines:
- if self._wrapper:
- lines = self._wrapper.wrap(rawline)
- else:
- lines = [rawline]
+ lines = self._wrapper(rawline)
for line in lines:
if firstline:
- logfunc("%s%s" % (prefix, line.lstrip()))
+ logfunc(prefix + line.lstrip())
firstline = False
else:
logfunc(line)