diff options
author | Jason Kincl <kincljc@ornl.gov> | 2012-11-19 10:37:34 -0500 |
---|---|---|
committer | Jason Kincl <kincljc@ornl.gov> | 2012-11-19 10:37:34 -0500 |
commit | 894299b01b6138c54a99fd41f166554d175d6106 (patch) | |
tree | 88e11cb8c49d3f933cf5f622a93dfa123922960f /src/lib/Bcfg2/Server/Plugin | |
parent | de0ae51b6dc635a3acd2491d4ca3fd021aa55873 (diff) | |
parent | f4da37aa0a360add3f5c40f37cd3cc010ef8788f (diff) | |
download | bcfg2-894299b01b6138c54a99fd41f166554d175d6106.tar.gz bcfg2-894299b01b6138c54a99fd41f166554d175d6106.tar.bz2 bcfg2-894299b01b6138c54a99fd41f166554d175d6106.zip |
Merge remote branch 'upstream/master' into jasons-hacking
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugin')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/base.py | 18 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/helpers.py | 10 |
2 files changed, 18 insertions, 10 deletions
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. diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index 894ed9851..318bf03f1 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -1526,12 +1526,12 @@ class GroupSpool(Plugin, Generator): else: return self.handles[event.requestID].rstrip("/") - def toggle_debug(self): + def set_debug(self, debug): for entry in self.entries.values(): - if hasattr(entry, "toggle_debug"): - entry.toggle_debug() - return Plugin.toggle_debug(self) - toggle_debug.__doc__ = Plugin.toggle_debug.__doc__ + if hasattr(entry, "set_debug"): + entry.set_debug(debug) + return Plugin.set_debug(self, debug) + set_debug.__doc__ = Plugin.set_debug.__doc__ def HandleEvent(self, event): """ HandleEvent is the event dispatcher for GroupSpool |