From edca0b698637c3fd0a70af7e4752a46afca938d3 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 23 Jan 2006 22:35:40 +0000 Subject: last step of repo switches git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1716 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/StatReports | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) mode change 100644 => 100755 src/sbin/StatReports (limited to 'src/sbin/StatReports') diff --git a/src/sbin/StatReports b/src/sbin/StatReports old mode 100644 new mode 100755 index ef6a8df66..cb74eb4bb --- a/src/sbin/StatReports +++ b/src/sbin/StatReports @@ -30,8 +30,7 @@ def generatereport(rspec, nrpt): pattern = re.compile( '|'.join([item.get("name") for item in reportspec.findall('Machine')])) for node in nodereprt.findall('Node'): - if not (node.findall("HostInfo") and node.findall("Statistics") and - node.find("HostInfo").get("fqdn") and pattern.match(node.get('name'))): + if not (node.findall("Statistics") and pattern.match(node.get('name'))): # don't know enough about node nodereprt.remove(node) continue @@ -151,8 +150,7 @@ if __name__ == '__main__': c.read(['/etc/bcfg2.conf']) configpath = "%s/etc/report-configuration.xml" % c.get('server', 'repository') statpath = "%s/etc/statistics.xml" % c.get('server', 'repository') - hostinfopath = "%s/etc/hostinfo.xml" % c.get('server', 'repository') - metadatapath = "%s/etc/metadata.xml" % c.get('server', 'repository') + clientsdatapath = "%s/Metadata/clients.xml" % c.get('server', 'repository') transformpath = "/usr/share/bcfg2/xsl-transforms/" #websrcspath = "/usr/share/bcfg2/web-rprt-srcs/" @@ -173,12 +171,12 @@ if __name__ == '__main__': #See if hostinfo.xml exists, and is less than 23.5 hours old - try: - hostinstat = os.stat(hostinfopath) - if (time() - hostinstat[9])/(60*60) > 23.5: - os.system('GenerateHostInfo')#Generate HostInfo needs to be in path - except OSError: - os.system('GenerateHostInfo')#Generate HostInfo needs to be in path + #try: + #hostinstat = os.stat(hostinfopath) + #if (time() - hostinstat[9])/(60*60) > 23.5: + os.system('GenerateHostInfo')#Generate HostInfo needs to be in path + #except OSError: + # os.system('GenerateHostInfo')#Generate HostInfo needs to be in path '''Reads Data & Config files''' @@ -193,16 +191,10 @@ if __name__ == '__main__': print("StatReports: Failed to parse %s"%(configpath)) raise SystemExit, 1 try: - metadata = XML(open(metadatapath).read()) + clientsdata = XML(open(clientsdatapath).read()) except (IOError, XMLSyntaxError): - print("StatReports: Failed to parse %s"%(metadatapath)) + print("StatReports: Failed to parse %s"%(clientsdatapath)) raise SystemExit, 1 - try: - hostinfodata = XML(open(hostinfopath).read()) - except (IOError, XMLSyntaxError): - print("StatReports: Failed to parse %s. Is GenerateHostInfo in your path?"%(hostinfopath)) - raise SystemExit, 1 - #Merge data from three sources nodereport = Element("Report", attrib={"time" : asctime()}) @@ -210,12 +202,9 @@ if __name__ == '__main__': #should all of the other info in Metadata be appended? #What about all of the package stuff for other types of reports? - for client in metadata.findall("Client"): + for client in clientsdata.findall("Client"): nodel = Element("Node", attrib={"name" : client.get("name")}) nodel.append(client) - for hostinfo in hostinfodata.findall("HostInfo"): - if hostinfo.get("name") == client.get("name"): - nodel.append(hostinfo) for nod in statsdata.findall("Node"): if client.get('name').find(nod.get('name')) == 0: -- cgit v1.2.3-1-g7c22