From e5cb0cc36c58c256921c1d658ace121f624ef6c3 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Mon, 13 Aug 2012 15:47:05 -0500 Subject: Remove bcfg2-ping-sweep Signed-off-by: Sol Jerome --- man/bcfg2-ping-sweep.8 | 14 ------- src/sbin/bcfg2-ping-sweep | 70 -------------------------------- tools/manpagegen/bcfg2-ping-sweep.8.ronn | 16 -------- 3 files changed, 100 deletions(-) delete mode 100644 man/bcfg2-ping-sweep.8 delete mode 100755 src/sbin/bcfg2-ping-sweep delete mode 100644 tools/manpagegen/bcfg2-ping-sweep.8.ronn diff --git a/man/bcfg2-ping-sweep.8 b/man/bcfg2-ping-sweep.8 deleted file mode 100644 index 709f0eed6..000000000 --- a/man/bcfg2-ping-sweep.8 +++ /dev/null @@ -1,14 +0,0 @@ -. -.TH "BCFG2\-PING\-SWEEP" "8" "June 2012" "" "" -. -.SH "NAME" -\fBbcfg2\-ping\-sweep\fR \- Update pingable and pingtime attributes in clients\.xml -. -.SH "SYNOPSIS" -\fBbcfg2\-ping\-sweep\fR -. -.SH "DESCRIPTION" -\fBbcfg2\-ping\-sweep\fR traverses the list of clients in Metadata/clients\.xml and updates their pingable/pingtime attributes\. The pingtime value is set to the last time the client was pinged (not the RTT value)\. -. -.SH "SEE ALSO" -bcfg2(1), bcfg2\-server(8) diff --git a/src/sbin/bcfg2-ping-sweep b/src/sbin/bcfg2-ping-sweep deleted file mode 100755 index be8994be3..000000000 --- a/src/sbin/bcfg2-ping-sweep +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -#GenerateHostInfo - Joey Hagedorn - hagedorn@mcs.anl.gov - -"""Generates hostinfo.xml at a regular interval.""" - -from os import dup2, execl, fork, uname, wait -import sys -import time -import lxml.etree - -import Bcfg2.Options - -if __name__ == '__main__': - opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY, - 'configfile': Bcfg2.Options.CFILE} - setup = Bcfg2.Options.OptionParser(opts) - setup.parse(sys.argv[1:]) - - 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")] - - pids = {} - null = open('/dev/null', 'w+') - - #use uname to detect OS and use -t for darwin and -w for linux - #/bin/ping on linux /sbin/ping on os x - osname = uname()[0] - - while hostlist or pids: - if hostlist and len(list(pids.keys())) < 15: - host = hostlist.pop() - pid = fork() - if pid == 0: - # in child - dup2(null.fileno(), sys.__stdin__.fileno()) - dup2(null.fileno(), sys.__stdout__.fileno()) - dup2(null.fileno(), sys.__stderr__.fileno()) - if osname == 'Linux': - execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host) - elif osname in ['Darwin', 'FreeBSD']: - execl('/sbin/ping', 'ping', '-t', '5', '-c', '1', host) - elif osname == 'SunOS': - execl('/usr/sbin/ping', 'ping', host, '56', '1') - else: # default - execl('/bin/ping', 'ping', '-w', '5', '-c', '1', host) - else: - pids[pid] = host - else: - try: - (cpid, status) = wait() - except OSError: - continue - chost = pids[cpid] - del pids[cpid] - elm = clientElement.xpath("//Client[@name='%s']" % chost)[0] - if status == 0: - elm.set("pingable", 'Y') - elm.set("pingtime", str(time.time())) - else: - elm.set("pingable", 'N') - - fout = open(clientdatapath, 'w') - fout.write(lxml.etree.tostring(clientElement.getroot(), - encoding='UTF-8', - xml_declaration=True)) - fout.close() diff --git a/tools/manpagegen/bcfg2-ping-sweep.8.ronn b/tools/manpagegen/bcfg2-ping-sweep.8.ronn deleted file mode 100644 index 815e0af5b..000000000 --- a/tools/manpagegen/bcfg2-ping-sweep.8.ronn +++ /dev/null @@ -1,16 +0,0 @@ -bcfg2-ping-sweep(8) -- Update pingable and pingtime attributes in clients.xml -============================================================================= - -## SYNOPSIS - -`bcfg2-ping-sweep` - -## DESCRIPTION - -`bcfg2-ping-sweep` traverses the list of clients in Metadata/clients.xml -and updates their pingable/pingtime attributes. The pingtime value is -set to the last time the client was pinged (not the RTT value). - -## SEE ALSO - -bcfg2(1), bcfg2-server(8) -- cgit v1.2.3-1-g7c22