From 8c4089d7e33a3eae0a53613b1fe491d7808a9ba3 Mon Sep 17 00:00:00 2001 From: Tim Laszlo Date: Fri, 4 Jun 2010 19:20:16 +0000 Subject: Added ThreadedStatistics plugin class. Migrated DBStats to use ThreadedStatistics. git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5889 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/DBStats.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/Server/Plugins/DBStats.py') diff --git a/src/lib/Server/Plugins/DBStats.py b/src/lib/Server/Plugins/DBStats.py index 49048fad9..1b8052c2d 100644 --- a/src/lib/Server/Plugins/DBStats.py +++ b/src/lib/Server/Plugins/DBStats.py @@ -13,14 +13,14 @@ from Bcfg2.Server.Reports.updatefix import update_database logger = logging.getLogger('Bcfg2.Plugins.DBStats') class DBStats(Bcfg2.Server.Plugin.Plugin, - Bcfg2.Server.Plugin.Statistics, + Bcfg2.Server.Plugin.ThreadedStatistics, Bcfg2.Server.Plugin.PullSource): name = 'DBStats' __version__ = '$Id$' def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) - Bcfg2.Server.Plugin.Statistics.__init__(self) + Bcfg2.Server.Plugin.ThreadedStatistics.__init__(self, core, datastore) Bcfg2.Server.Plugin.PullSource.__init__(self) self.cpath = "%s/Metadata/clients.xml" % datastore self.core = core @@ -31,13 +31,13 @@ class DBStats(Bcfg2.Server.Plugin.Plugin, logger.debug(str(inst)) logger.debug(str(type(inst))) - def process_statistics(self, mdata, xdata): - newstats = xdata.find("Statistics") + def handle_statistic(self, metadata, data): + newstats = data.find("Statistics") newstats.set('time', time.asctime(time.localtime())) # ick - xdata = lxml.etree.tostring(newstats) - ndx = lxml.etree.XML(xdata) - e = lxml.etree.Element('Node', name=mdata.hostname) + data = lxml.etree.tostring(newstats) + ndx = lxml.etree.XML(data) + e = lxml.etree.Element('Node', name=metadata.hostname) e.append(ndx) container = lxml.etree.Element("ConfigStatistics") container.append(e) -- cgit v1.2.3-1-g7c22