summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Plugins/Reporting.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-27 12:09:18 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-27 12:12:35 -0500
commit92122665e534978a1bdb499e6b8cf48e54b041d3 (patch)
treee4271e96d051c7ddabe96ba9c43d589dffd4bb35 /src/lib/Bcfg2/Server/Plugins/Reporting.py
parentc19e7da20ca6b67956338f9808a80673e06b1e94 (diff)
downloadbcfg2-92122665e534978a1bdb499e6b8cf48e54b041d3.tar.gz
bcfg2-92122665e534978a1bdb499e6b8cf48e54b041d3.tar.bz2
bcfg2-92122665e534978a1bdb499e6b8cf48e54b041d3.zip
made Reporting plugin and transports debuggable, respond to set_debug/toggle_debug RMI
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Reporting.py')
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Reporting.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py
index b9d397590..60f5b1e09 100644
--- a/src/lib/Bcfg2/Server/Plugins/Reporting.py
+++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py
@@ -8,7 +8,7 @@ from Bcfg2.Reporting.Transport import load_transport_from_config, \
TransportError
from Bcfg2.Options import REPORTING_COMMON_OPTIONS
from Bcfg2.Server.Plugin import Statistics, PullSource, Threaded, \
- PluginInitError, PluginExecutionError
+ Debuggable, PluginInitError, PluginExecutionError
# required for reporting
try:
@@ -31,9 +31,10 @@ def _rpc_call(method):
return _real_rpc_call
-class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
+# pylint: disable=W0223
+class Reporting(Statistics, Threaded, PullSource, Debuggable):
""" Unified statistics and reporting plugin """
- __rmi__ = ['Ping', 'GetExtra', 'GetCurrentEntry']
+ __rmi__ = Debuggable.__rmi__ + ['Ping', 'GetExtra', 'GetCurrentEntry']
CLIENT_METADATA_FIELDS = ('profile', 'bundles', 'aliases', 'addresses',
'groups', 'categories', 'uuid', 'version')
@@ -42,7 +43,7 @@ class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
Statistics.__init__(self, core, datastore)
PullSource.__init__(self)
Threaded.__init__(self)
- self.core = core
+ Debuggable.__init__(self)
self.whoami = platform.node()
self.transport = None
@@ -55,8 +56,6 @@ class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
self.logger.error(msg)
raise PluginInitError(msg)
- self.transport = None
-
def start_threads(self):
try:
self.transport = load_transport_from_config(self.core.setup)
@@ -66,6 +65,11 @@ class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
self.logger.error(msg)
raise PluginInitError(msg)
+ def set_debug(self, debug):
+ rv = Debuggable.set_debug(self, debug)
+ self.transport.set_debug(debug)
+ return rv
+
def process_statistics(self, client, xdata):
stats = xdata.find("Statistics")
stats.set('time', time.asctime(time.localtime()))
@@ -88,8 +92,8 @@ class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
lxml.etree.tostring(
stats,
xml_declaration=False).decode('UTF-8'))
- self.logger.debug("%s: Queued statistics data for %s" %
- (self.__class__.__name__, client.hostname))
+ self.debug_log("%s: Queued statistics data for %s" %
+ (self.__class__.__name__, client.hostname))
return
except TransportError:
continue
@@ -98,7 +102,7 @@ class Reporting(Statistics, Threaded, PullSource): # pylint: disable=W0223
% (self.__class__.__name__, i,
traceback.format_exc().splitlines()[-1]))
self.logger.error("%s: Retry limit reached for %s" %
- (self.__class__.__name__, client.hostname))
+ (self.__class__.__name__, client.hostname))
def shutdown(self):
super(Reporting, self).shutdown()