From 764100713792f761091870a17d914a27e59a5d20 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Tue, 22 Aug 2006 17:42:37 +0000 Subject: Add -C option to bcfg2-repo-validate (resolves Ticket #97) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2083 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-repo-validate | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate index 67ebf12f1..c0bca6ef0 100644 --- a/src/sbin/bcfg2-repo-validate +++ b/src/sbin/bcfg2-repo-validate @@ -10,8 +10,12 @@ if __name__ == '__main__': if '-v' in sys.argv: verbose = True sys.argv.remove('-v') + if '-C' in sys.argv: + cpath = sys.argv[sys.argv.index('-C') + 1] + else: + cpath = '/etc/bcfg2.conf' cf = ConfigParser.ConfigParser() - cf.read(['/etc/bcfg2.conf']) + cf.read([cpath]) try: prefix = cf.get('server', 'prefix') except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): @@ -19,17 +23,13 @@ if __name__ == '__main__': if verbose: print "Using installation prefix %s" % (prefix) schemadir = "%s/share/bcfg2/schemas" % (prefix) - if len(sys.argv) > 1: - repo = sys.argv[1] - else: - try: - repo = cf.get('server', 'repository') - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): - print "Repository location not specified in config file or on command line" - print "Usage: bcfg2-repo-validate [-v] " - raise SystemExit, 1 - # add more validation as more schemas get written + try: + repo = cf.get('server', 'repository') + except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + print "Repository location not specified in config file" + raise SystemExit, 1 + filesets = {'metadata':("%s/Metadata/groups.xml", "%s/metadata.xsd"), 'clients':("%s/Metadata/clients.xml", "%s/clients.xsd"), 'bundle':("%s/Bundler/*.xml", "%s/bundle.xsd"), -- cgit v1.2.3-1-g7c22