summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-08-22 17:42:37 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-08-22 17:42:37 +0000
commit764100713792f761091870a17d914a27e59a5d20 (patch)
treecf2881627d49cb2c297c41e21b117359ef010569
parent46b5982281259323718274fd858946eeaac0e3a7 (diff)
downloadbcfg2-764100713792f761091870a17d914a27e59a5d20.tar.gz
bcfg2-764100713792f761091870a17d914a27e59a5d20.tar.bz2
bcfg2-764100713792f761091870a17d914a27e59a5d20.zip
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
-rw-r--r--man/bcfg2-repo-validate.815
-rw-r--r--src/sbin/bcfg2-repo-validate22
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] <repo directory>"
- 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"),