diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2005-09-27 21:49:53 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2005-09-27 21:49:53 +0000 |
commit | f0a29d30bf455ad018173a659b32dcf1b26669f7 (patch) | |
tree | dc93607cb80007019c0c0349bcfd33d87fc03fac /src/sbin | |
parent | eb6060070afdeceabc4ecb7511b8b66b8fa267db (diff) | |
download | bcfg2-f0a29d30bf455ad018173a659b32dcf1b26669f7.tar.gz bcfg2-f0a29d30bf455ad018173a659b32dcf1b26669f7.tar.bz2 bcfg2-f0a29d30bf455ad018173a659b32dcf1b26669f7.zip |
Update so that fully-qualified client names function properly
fix some pylint errors
(Logical change 1.324)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1323 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rw-r--r-- | src/sbin/GenerateHostInfo | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sbin/GenerateHostInfo b/src/sbin/GenerateHostInfo index bd02fd8cf..547237bbc 100644 --- a/src/sbin/GenerateHostInfo +++ b/src/sbin/GenerateHostInfo @@ -2,24 +2,25 @@ # Jul 17 2005 #GenerateHostInfo - Joey Hagedorn - hagedorn@mcs.anl.gov -__revision__ = '$Revision$' '''Generates hostinfo.xml at a regular interval''' +__revision__ = '$Revision$' from ConfigParser import ConfigParser -from elementtree.ElementTree import * -from xml.parsers.expat import ExpatError +from elementtree.ElementTree import Element, SubElement, parse from os import system -from socket import gethostbyname, gethostbyaddr, gaierror +from socket import gethostbyname, gaierror def buildfqdncache(domain_list, host_list): '''build dictionary of hostname to fqdns''' fqdncache = {} for nodename in host_list: + if nodename.count('.') > 0: + fqdncache[nodename] = nodename fqdncache[nodename] = "" for domain in domain_list: try: fqdn = "%s.%s" % (nodename, domain) - ipaddr = gethostbyname(fqdn) + gethostbyname(fqdn) fqdncache[nodename] = fqdn break except gaierror: @@ -52,7 +53,7 @@ if __name__ == '__main__': sendmailpath = c.get('statistics','sendmailpath') metaElement = parse(metadatapath) - hostlist = map(lambda x:x.get("name"), metaElement.findall("Client")) + hostlist = [client.get('name') for client in metaElement.findall("Client")] fqdn_cache = buildfqdncache(domainlist, hostlist) |