diff options
author | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-01-09 23:12:33 +0000 |
---|---|---|
committer | Joey Hagedorn <hagedorn@mcs.anl.gov> | 2006-01-09 23:12:33 +0000 |
commit | 0f95b5db21e8a9247834befa21fe56b8d9f7e16e (patch) | |
tree | 90e6f8e333535a7807f1594467d4195ad564af9d /src/sbin | |
parent | e1ba4d1443e2fae8b626d5282dd633aab2144dcb (diff) | |
download | bcfg2-0f95b5db21e8a9247834befa21fe56b8d9f7e16e.tar.gz bcfg2-0f95b5db21e8a9247834befa21fe56b8d9f7e16e.tar.bz2 bcfg2-0f95b5db21e8a9247834befa21fe56b8d9f7e16e.zip |
made changes to get rid of hostinfo.xml file have GenerateHostInfo update clients.xml
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1659 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rw-r--r-- | src/sbin/GenerateHostInfo | 20 | ||||
-rw-r--r-- | src/sbin/StatReports | 15 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/sbin/GenerateHostInfo b/src/sbin/GenerateHostInfo index 04d257e8a..e6d166877 100644 --- a/src/sbin/GenerateHostInfo +++ b/src/sbin/GenerateHostInfo @@ -31,14 +31,14 @@ if __name__ == '__main__': c = ConfigParser() c.read(['/etc/bcfg2.conf']) configpath = "%s/etc/report-configuration.xml" % c.get('server', 'repository') - hostinfopath = "%s/etc/hostinfo.xml" % c.get('server', 'repository') - metadatapath = "%s/etc/metadata.xml" % c.get('server', 'repository') + #hostinfopath = "%s/etc/hostinfo.xml" % c.get('server', 'repository') + clientdatapath = "%s/Metadata/clients.xml" % c.get('server', 'repository') sendmailpath = c.get('statistics','sendmailpath') - metaElement = parse(metadatapath) - hostlist = [client.get('name') for client in metaElement.findall("Client")] + clientElement = parse(clientdatapath) + hostlist = [client.get('name') for client in clientElement.findall("Client")] - HostInfo = Element("HostInformation") + #HostInfo = Element("HostInformation") pids = {} fullnames = {} null = open('/dev/null', 'w+') @@ -60,17 +60,19 @@ if __name__ == '__main__': chost = pids[cpid] del pids[cpid] if status == 0: - SubElement(HostInfo, "HostInfo", name=chost, fqdn=chost, pingable='Y') + #SubElement(HostInfo, "HostInfo", name=chost, fqdn=chost, pingable='Y') + clientElement.xpath("/Clients/Client[@name=%s]"%chost).set("pingable",'Y') else: if chost.count('.') > 0: fullnames[chost.split('.')[0]] = chost hostlist.append(chost.split('.')[0]) else: - SubElement(HostInfo, "HostInfo", name=fullnames[chost], fqdn=fullnames[chost], pingable='N') + #SubElement(HostInfo, "HostInfo", name=fullnames[chost], fqdn=fullnames[chost], pingable='N') + clientElement.xpath("/Clients/Client[@name=%s]"%chost).set("pingable",'N') except: pass - fout = open(hostinfopath, 'w') - fout.write(pretty_print(HostInfo)) + fout = open(clientdatapath, 'w') + fout.write(pretty_print(clientElement)) fout.close() diff --git a/src/sbin/StatReports b/src/sbin/StatReports index 439998718..d08d38a57 100644 --- 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 @@ -173,12 +172,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''' |