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 --- man/bcfg2-repo-validate.8 | 15 +++++++-------- src/sbin/bcfg2-repo-validate | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/man/bcfg2-repo-validate.8 b/man/bcfg2-repo-validate.8 index 7000c8ece..d00885313 100644 --- a/man/bcfg2-repo-validate.8 +++ b/man/bcfg2-repo-validate.8 @@ -3,19 +3,18 @@ bcfg2-repo-validate \- Check Bcfg2 repository data against data schemas .SH SYNOPSIS .B bcfg2-repo-validate -.I [-v] [ Repository Location ] [ Schema Location ] +.I [-v] .SH DESCRIPTION .PP .B bcfg2-repo-validate This script checks data against schemas, and it quite helpful in finding typos or malformed data. -.SH ARGUMENTS -.TP -.B Repository Location - where the data repository is. -.TP -.B Schema Location - where schemas are. (Optional). -.SH "OPTIONS" -.OO +.SH OPTIONS +.PP +.B "\-C" +.RS +Specify path to bcfg2.conf (default /etc/bcfg2.conf) +.RE .SH "SEE ALSO" .BR bcfg2(1), .BR bcfg2-server(8) 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