From bf8becbdcaae2c9f7b09925ecd9547fd3f6a72fe Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 21 Mar 2013 13:36:56 -0400 Subject: added XML-RPC RMI capabilities to FileMonitor objects --- src/lib/Bcfg2/Server/FileMonitor/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/Bcfg2/Server/FileMonitor') diff --git a/src/lib/Bcfg2/Server/FileMonitor/__init__.py b/src/lib/Bcfg2/Server/FileMonitor/__init__.py index 42ad4c041..58144958e 100644 --- a/src/lib/Bcfg2/Server/FileMonitor/__init__.py +++ b/src/lib/Bcfg2/Server/FileMonitor/__init__.py @@ -116,6 +116,9 @@ class FileMonitor(Debuggable): #: should have higher priorities. __priority__ = -1 + #: List of names of methods to be exposed as XML-RPC functions + __rmi__ = Debuggable.__rmi__ + ["list_event_handlers"] + def __init__(self, ignore=None, debug=False): """ :param ignore: A list of filename globs describing events that @@ -310,6 +313,15 @@ class FileMonitor(Debuggable): """ raise NotImplementedError + def list_event_handlers(self): + """ XML-RPC that returns + :attr:`Bcfg2.Server.FileMonitor.FileMonitor.handles` for + debugging purposes. """ + rv = dict() + for watch, handler in self.handles.items(): + rv[watch] = getattr(handler, "name", handler.__class__.__name__) + return rv + #: A dict of all available FAM backends. Keys are the human-readable #: names of the backends, which are used in bcfg2.conf to select a -- cgit v1.2.3-1-g7c22