diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-06-05 05:29:02 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-06-05 05:55:48 -0500 |
commit | 11913d1203f928eee1b549d7232e205626a5bb88 (patch) | |
tree | c08b4a9e971680708e63856798e19fb9fddd6e7b /src/lib/Bcfg2/Server/Plugins | |
parent | be914202afa067353601c27ddcdd751da0ebe44b (diff) | |
download | bcfg2-11913d1203f928eee1b549d7232e205626a5bb88.tar.gz bcfg2-11913d1203f928eee1b549d7232e205626a5bb88.tar.bz2 bcfg2-11913d1203f928eee1b549d7232e205626a5bb88.zip |
DBStats: Stop building a ConfigStatistics xml
Created a load_stat method in impot script.
Pass the Statistic data to load_stat instead of building a
ConfigStatistics/Node XML root.
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/DBStats.py | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/DBStats.py b/src/lib/Bcfg2/Server/Plugins/DBStats.py index ca09b430c..469fafa5c 100644 --- a/src/lib/Bcfg2/Server/Plugins/DBStats.py +++ b/src/lib/Bcfg2/Server/Plugins/DBStats.py @@ -12,7 +12,7 @@ except ImportError: pass import Bcfg2.Server.Plugin -import Bcfg2.Server.Reports.importscript +from Bcfg2.Server.Reports.importscript import load_stat from Bcfg2.Server.Reports.reports.models import Client import Bcfg2.Server.Reports.settings from Bcfg2.Server.Reports.Updater import update_database, UpdaterError @@ -45,25 +45,17 @@ class DBStats(Bcfg2.Server.Plugin.Plugin, def handle_statistic(self, metadata, data): newstats = data.find("Statistics") newstats.set('time', time.asctime(time.localtime())) - # ick - 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) - # FIXME need to build a metadata interface to expose a list of clients start = time.time() for i in [1, 2, 3]: try: - Bcfg2.Server.Reports.importscript.load_stats(self.core.metadata.clients_xml.xdata, - container, - self.core.encoding, - 0, - logger, - True, - platform.node()) + load_stat(metadata.hostname, + newstats, + self.core.encoding, + 0, + logger, + True, + platform.node()) logger.info("Imported data for %s in %s seconds" \ % (metadata.hostname, time.time() - start)) return |