summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/FileMonitor
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-16 09:22:06 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-16 09:57:53 -0500
commit924ce4f763bbc0aa47a9f79c5279c61fa8070716 (patch)
tree919ca7e6ece14cec02da7f3e43a13c150ad23976 /src/lib/Bcfg2/Server/FileMonitor
parent00627ba56075a0d0cb42356624ae6989521270bc (diff)
downloadbcfg2-924ce4f763bbc0aa47a9f79c5279c61fa8070716.tar.gz
bcfg2-924ce4f763bbc0aa47a9f79c5279c61fa8070716.tar.bz2
bcfg2-924ce4f763bbc0aa47a9f79c5279c61fa8070716.zip
FAM: allow toggling FAM debug by RMI on running server
Diffstat (limited to 'src/lib/Bcfg2/Server/FileMonitor')
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/Inotify.py4
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/__init__.py14
2 files changed, 6 insertions, 12 deletions
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