summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/sbin/bcfg2-repo-validate22
1 files changed, 11 insertions, 11 deletions
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"),