diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2011-03-17 10:09:21 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2011-03-17 10:09:21 -0500 |
commit | 9f6bc110ab59108d24cb71bc3d866f44cc0248c6 (patch) | |
tree | 88ec691f73a060eb04ad11817fd2367eb1aaa1aa /src/sbin | |
parent | a6df9ca354ed4f7e1e569a0c858dbc3b6e68faa1 (diff) | |
download | bcfg2-9f6bc110ab59108d24cb71bc3d866f44cc0248c6.tar.gz bcfg2-9f6bc110ab59108d24cb71bc3d866f44cc0248c6.tar.bz2 bcfg2-9f6bc110ab59108d24cb71bc3d866f44cc0248c6.zip |
man: Add man page for bcfg2-ping-sweep (#997)
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2-ping-sweep | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/sbin/bcfg2-ping-sweep b/src/sbin/bcfg2-ping-sweep index 4082cad8b..718ad69d0 100755 --- a/src/sbin/bcfg2-ping-sweep +++ b/src/sbin/bcfg2-ping-sweep @@ -8,7 +8,7 @@ __revision__ = '$Revision$' from os import dup2, execl, fork, uname, wait import sys import time -import lxml.etree +import lxml.etree import Bcfg2.Options @@ -20,9 +20,10 @@ if __name__ == '__main__': cfpath = setup['configfile'] clientdatapath = "%s/Metadata/clients.xml" % setup['repo'] - + clientElement = lxml.etree.parse(clientdatapath) - hostlist = [client.get('name') for client in clientElement.findall("Client")] + hostlist = [client.get('name') + for client in clientElement.findall("Client")] pids = {} null = open('/dev/null', 'w+') @@ -31,7 +32,6 @@ if __name__ == '__main__': #/bin/ping on linux /sbin/ping on os x osname = uname()[0] - while hostlist or pids: if hostlist and len(pids.keys()) < 15: host = hostlist.pop() @@ -47,7 +47,7 @@ if __name__ == '__main__': execl('/sbin/ping', 'ping', '-t', '5', '-c', '1', host) elif osname == 'SunOS': execl('/usr/sbin/ping', 'ping', host, '56', '1') - else: #default + else: # default execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host) else: pids[pid] = host @@ -58,14 +58,15 @@ if __name__ == '__main__': continue chost = pids[cpid] del pids[cpid] - elm = clientElement.xpath("//Client[@name='%s']"%chost)[0] + elm = clientElement.xpath("//Client[@name='%s']" % chost)[0] if status == 0: - elm.set("pingable",'Y') + elm.set("pingable", 'Y') elm.set("pingtime", str(time.time())) else: - elm.set("pingable",'N') + elm.set("pingable", 'N') fout = open(clientdatapath, 'w') - fout.write(lxml.etree.tostring(clientElement.getroot(), encoding='UTF-8', xml_declaration=True)) + fout.write(lxml.etree.tostring(clientElement.getroot(), + encoding='UTF-8', + xml_declaration=True)) fout.close() - |