From ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 31 Dec 2007 11:21:10 +0000 Subject: Switch over to more Options usage and complete tests (everything appears to work now) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4142 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-ping-sweep | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/sbin/bcfg2-ping-sweep') diff --git a/src/sbin/bcfg2-ping-sweep b/src/sbin/bcfg2-ping-sweep index 02e6d1f0e..ae4918d1f 100755 --- a/src/sbin/bcfg2-ping-sweep +++ b/src/sbin/bcfg2-ping-sweep @@ -5,24 +5,20 @@ __revision__ = '$Revision$' from os import dup2, execl, fork, uname, wait -import lxml.etree, sys, time, ConfigParser -from Bcfg2.Settings import settings +import lxml.etree, sys, time +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:]) - - # override default settings - if '-C' in sys.argv: - settings.read_config_file(sys.argv[sys.argv.index('-C') + 1]) - - clientdatapath = "%s/Metadata/clients.xml" % settings.SERVER_REPOSITORY + cfpath opts['configfile'] + clientdatapath = "%s/Metadata/clients.xml" % opts['repo'] - try: - clientElement = lxml.etree.parse(clientdatapath) - except: - print "Failed to parse '%s'" % clientdatapath - raise SystemExit, 1 + clientElement = lxml.etree.parse(clientdatapath) hostlist = [client.get('name') for client in clientElement.findall("Client")] pids = {} -- cgit v1.2.3-1-g7c22