diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-01-23 22:35:40 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-01-23 22:35:40 +0000 |
commit | edca0b698637c3fd0a70af7e4752a46afca938d3 (patch) | |
tree | 658fad717833200ccb4e3725c811ccce7c10fc8d /src/sbin/ValidateBcfg2Repo | |
parent | 8ca8a153dfc6bd81ede9f5cff1ee3f111ae053ee (diff) | |
download | bcfg2-edca0b698637c3fd0a70af7e4752a46afca938d3.tar.gz bcfg2-edca0b698637c3fd0a70af7e4752a46afca938d3.tar.bz2 bcfg2-edca0b698637c3fd0a70af7e4752a46afca938d3.zip |
last step of repo switches
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1716 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin/ValidateBcfg2Repo')
-rw-r--r-- | src/sbin/ValidateBcfg2Repo | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/sbin/ValidateBcfg2Repo b/src/sbin/ValidateBcfg2Repo deleted file mode 100644 index a1b9552ce..000000000 --- a/src/sbin/ValidateBcfg2Repo +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python - -'''ValidateBcfg2Repo checks all xml files in Bcfg2 repos against their respective XML schemas''' -__revision__ = '0.7.3' - -from glob import glob -from lxml.etree import parse, XMLSchema -from os import system -from sys import argv -from ConfigParser import ConfigParser, NoSectionError, NoOptionError - -if __name__ == '__main__': - cf = ConfigParser() - schemadir = '/usr/share/bcfg2/schemas' - cf.read(['/etc/bcfg2.conf']) - try: - repo = cf.get('server', 'repository') - except (NoSectionError, NoOptionError): - if len(argv) == 1: - print "Repository location not specified in config file or on command line" - print "Usage: validate_repo <repo directory>" - raise SystemExit, 1 - repo = argv[1] - - # add more validation as more schemas get written - filesets = {'metadata':("%s/etc/metadata.xml", "%s/metadata.xsd"), - 'bundle':("%s/Bundler/*.xml", "%s/bundle.xsd"), - 'pkglist':("%s/Pkgmgr/*.xml", "%s/pkglist.xsd"), - 'base':("%s/etc/base.xml", "%s/base.xsd"), - 'imageinfo':("%s/etc/imageinfo.xml", "%s/translation.xsd"), - 'imageinfo':("%s/etc/reports.xml", "%s/report-configuration.xsd"), - 'services':("%s/etc/services.xml", "%s/services.xsd")} - - for k, (spec, schemaname) in filesets.iteritems(): - schema = XMLSchema(parse(open(schemaname%(schemadir)))) - for filename in glob(spec%(repo)): - try: - datafile = parse(open(filename)) - except SyntaxError: - print "%s ***FAILS*** to parse \t\t<----" % (filename) - system("xmllint %s" % filename) - continue - except IOError: - print "Failed to open file %s \t\t<---" % (filename) - continue - if schema.validate(datafile): - if '-v' in argv: - print "%s checks out" % (filename) - else: - print "%s ***FAILS*** to verify \t\t<----" % (filename) - system("xmllint --schema %s %s" % (schemaname % schemadir, filename)) |