summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-08-06 19:12:44 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-08-06 19:12:44 +0000
commit8bec0056b9d8f1accb9cbaa485c6011980d381df (patch)
treeb496838e3693b1ff0302a57db2053cf3923a50f8 /src/lib/Server/Plugins
parent42ce77fd3274783e17a4f4b619d052f427d25099 (diff)
downloadbcfg2-8bec0056b9d8f1accb9cbaa485c6011980d381df.tar.gz
bcfg2-8bec0056b9d8f1accb9cbaa485c6011980d381df.tar.bz2
bcfg2-8bec0056b9d8f1accb9cbaa485c6011980d381df.zip
Switch bcfg2-admin minestruct to use the new statistics api to get at data in either of statistics.xml or dbstats directly
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4862 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins')
-rw-r--r--src/lib/Server/Plugins/DBStats.py6
-rw-r--r--src/lib/Server/Plugins/Statistics.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/DBStats.py b/src/lib/Server/Plugins/DBStats.py
index b0d6779a6..6e9be82d0 100644
--- a/src/lib/Server/Plugins/DBStats.py
+++ b/src/lib/Server/Plugins/DBStats.py
@@ -1,5 +1,6 @@
import Bcfg2.Server.Plugin
import Bcfg2.Server.Reports.importscript
+from Bcfg2.Server.Reports.reports.models import Client
import lxml.etree, time
class DBStats(Bcfg2.Server.Plugin.StatisticsPlugin):
@@ -22,4 +23,9 @@ class DBStats(Bcfg2.Server.Plugin.StatisticsPlugin):
Bcfg2.Server.Reports.importscript.load_stats(
self.core.metadata.clientdata, container, 0, True)
+ def GetExtra(self, client):
+ c_inst = Client.objects.filter(name=client)[0]
+ return [(a.kind, a.name) for a in
+ c_inst.current_interaction.extra_items.all()]
+
diff --git a/src/lib/Server/Plugins/Statistics.py b/src/lib/Server/Plugins/Statistics.py
index 41de7ba4b..b7dc61179 100644
--- a/src/lib/Server/Plugins/Statistics.py
+++ b/src/lib/Server/Plugins/Statistics.py
@@ -119,9 +119,9 @@ class Statistics(Bcfg2.Server.Plugin.StatisticsPlugin):
self.data.WriteBack()
def FindCurrent(self, client):
- rt = self.data.element.xpath('//Node[@name="%s"]' % client)
- maxtime = max([time.strptime(stat.get('time')) for stat in rt.findall('Statistics')])
- return [stat for stat in rt.findall('Statistics') if time.strptime(stat.get('time')) == maxtime][0]
+ rt = self.data.element.xpath('//Node[@name="%s"]' % client)[0]
+ maxtime = max([strptime(stat.get('time')) for stat in rt.findall('Statistics')])
+ return [stat for stat in rt.findall('Statistics') if strptime(stat.get('time')) == maxtime][0]
def GetExtra(self, client):
return [(entry.tag, entry.get('name')) for entry in self.FindCurrent(client).xpath('.//Extra/*')]