summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Server/Core.py4
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/Inotify.py4
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/__init__.py14
3 files changed, 10 insertions, 12 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 6d0ad2bb9..b48c19467 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -1069,3 +1069,7 @@ class BaseCore(object):
""" Get current statistics about component execution from
:attr:`Bcfg2.Statistics.stats`. """
return Bcfg2.Statistics.stats.display()
+
+ @exposed
+ def toggle_fam_debug(self, _):
+ return self.fam.toggle_debug()
diff --git a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
index d5aa8e4ad..8a311c8c6 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
@@ -113,8 +113,8 @@ class Inotify(Pseudo, pyinotify.ProcessEvent):
try:
watch = self.watchmgr.watches[ievent.wd]
except KeyError:
- LOGGER.error("Error handling event for %s: Watch %s not found" %
- (ievent.pathname, ievent.wd))
+ LOGGER.error("Error handling event %s for %s: Watch %s not found" %
+ (action, ievent.pathname, ievent.wd))
return
# FAM-style file monitors return the full path to the parent
# directory that is being watched, relative paths to anything
diff --git a/src/lib/Bcfg2/Server/FileMonitor/__init__.py b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
index 72b1d2dd7..dad0db44e 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/__init__.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
@@ -50,6 +50,7 @@ import sys
import fnmatch
import logging
from time import sleep, time
+from Bcfg2.Server.Plugin import Debuggable
LOGGER = logging.getLogger(__name__)
@@ -104,7 +105,7 @@ class Event(object):
return "%s (request ID %s)" % (str(self), self.requestID)
-class FileMonitor(object):
+class FileMonitor(Debuggable):
""" The base class that all FAM implementions must inherit.
The simplest instance of a FileMonitor subclass needs only to add
@@ -128,8 +129,8 @@ class FileMonitor(object):
.. -----
.. autoattribute:: __priority__
"""
- #: Whether or not to produce debug logging
- self.debug = debug
+ Debuggable.__init__(self, name="FileMonitor")
+ self.debug_flag = debug
#: A dict that records which objects handle which events.
#: Keys are monitor handle IDs and values are objects whose
@@ -168,13 +169,6 @@ class FileMonitor(object):
example of this. """
self.started = True
- def debug_log(self, msg):
- """ Log a debug message.
-
- :param msg: The message to log iff :attr:`debug` is set."""
- if self.debug:
- LOGGER.info(msg)
-
def should_ignore(self, event):
""" Returns True if an event should be ignored, False
otherwise. For events that include the full path, both the