summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-16 09:28:37 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-16 09:57:54 -0500
commit1d953e4512c8d4cc9ce536da3522a59d812d58b9 (patch)
treeaa7cacf2f32acd1bece3d2fc8aa2dad7151c5f80 /src/lib
parentc57bcc40f4edad2666dc7b5fe718b2399d0edbf8 (diff)
downloadbcfg2-1d953e4512c8d4cc9ce536da3522a59d812d58b9.tar.gz
bcfg2-1d953e4512c8d4cc9ce536da3522a59d812d58b9.tar.bz2
bcfg2-1d953e4512c8d4cc9ce536da3522a59d812d58b9.zip
added set_debug RMI for plugins and core, set_fam_debug RMI
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Server/Core.py10
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/__init__.py2
-rw-r--r--src/lib/Bcfg2/Server/Plugin/base.py18
3 files changed, 24 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 7d980e58a..c23d3cf24 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -1079,3 +1079,13 @@ class BaseCore(object):
@exposed
def toggle_fam_debug(self, _):
return self.fam.toggle_debug()
+
+ @exposed
+ def set_debug(self, address, debug):
+ for plugin in self.plugins.values():
+ plugin.set_debug(debug)
+ return self.set_fam_debug(address, debug)
+
+ @exposed
+ def set_fam_debug(self, _, debug):
+ return self.fam.set_debug(debug)
diff --git a/src/lib/Bcfg2/Server/FileMonitor/__init__.py b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
index dad0db44e..42ad4c041 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/__init__.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/__init__.py
@@ -129,7 +129,7 @@ class FileMonitor(Debuggable):
.. -----
.. autoattribute:: __priority__
"""
- Debuggable.__init__(self, name="FileMonitor")
+ Debuggable.__init__(self)
self.debug_flag = debug
#: A dict that records which objects handle which events.
diff --git a/src/lib/Bcfg2/Server/Plugin/base.py b/src/lib/Bcfg2/Server/Plugin/base.py
index 8d288f835..e74909ee9 100644
--- a/src/lib/Bcfg2/Server/Plugin/base.py
+++ b/src/lib/Bcfg2/Server/Plugin/base.py
@@ -9,7 +9,7 @@ class Debuggable(object):
via XML-RPC on :class:`Bcfg2.Server.Plugin.base.Plugin` objects """
#: List of names of methods to be exposed as XML-RPC functions
- __rmi__ = ['toggle_debug']
+ __rmi__ = ['toggle_debug', 'set_debug']
def __init__(self, name=None):
"""
@@ -26,17 +26,25 @@ class Debuggable(object):
self.debug_flag = False
self.logger = logging.getLogger(name)
- def toggle_debug(self):
- """ Turn debugging output on or off. This method is exposed
+ def set_debug(self, debug):
+ """ Explicitly enable or disable debugging. This method is exposed
via XML-RPC.
:returns: bool - The new value of the debug flag
"""
- self.debug_flag = not self.debug_flag
+ self.debug_flag = debug
self.debug_log("%s: debug_flag = %s" % (self.__class__.__name__,
self.debug_flag),
flag=True)
- return self.debug_flag
+ return debug
+
+ def toggle_debug(self):
+ """ Turn debugging output on or off. This method is exposed
+ via XML-RPC.
+
+ :returns: bool - The new value of the debug flag
+ """
+ return self.set_debug(not self.debug_flag)
def debug_log(self, message, flag=None):
""" Log a message at the debug level.