summaryrefslogtreecommitdiffstats
path: root/src/sbin
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-01-21 02:14:51 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-01-21 02:14:51 +0000
commitbfef1b1c41c96c55033e334fe833e030ced8c450 (patch)
tree879b35d8264431b3b5e3a061a8d992ac9b46902a /src/sbin
parent33016cd1d7deeb9799b7b788d2dfccb18673437d (diff)
downloadbcfg2-bfef1b1c41c96c55033e334fe833e030ced8c450.tar.gz
bcfg2-bfef1b1c41c96c55033e334fe833e030ced8c450.tar.bz2
bcfg2-bfef1b1c41c96c55033e334fe833e030ced8c450.zip
Implement xml schema checks for info.xml files (from Sol Jerome) (Resolves Ticket #514) [bugfix]
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4269 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate
index 4f1e60e08..3c7bf70e6 100755
--- a/src/sbin/bcfg2-repo-validate
+++ b/src/sbin/bcfg2-repo-validate
@@ -21,25 +21,47 @@ if __name__ == '__main__':
os.chdir(schemadir)
repo = setup['repo']
- filesets = {'metadata':("%s/Metadata/groups.xml", "%s/metadata.xsd"),
- 'clients':("%s/Metadata/clients.xml", "%s/clients.xsd"),
- 'bundle':("%s/Bundler/*.xml", "%s/bundle.xsd"),
- 'pkglist':("%s/Pkgmgr/*.xml", "%s/pkglist.xsd"),
- 'base':("%s/Base/*.xml", "%s/base.xsd"),
- 'rules':("%s/Rules/*.xml", "%s/rules.xsd"),
- 'imageinfo':("%s/etc/report-configuration.xml", "%s/report-configuration.xsd"),
- 'services':("%s/Svcmgr/*.xml", "%s/services.xsd"),
- 'deps':("%s/Deps/*.xml", "%s/deps.xsd")}
+ '''
+ Get a list of all info.xml files
+ in Cfg directory and subdirectories
+ '''
+ info_list = []
+ for root, dirs, files in os.walk('%s/Cfg' % repo):
+ for file in files:
+ if 'info.xml' in file:
+ info_list.append(os.path.join(root, file))
+
+ # get lists of all other xml files to validate
+ metadata_list = glob.glob("%s/Metadata/groups.xml" % repo)
+ clients_list = glob.glob("%s/Metadata/clients.xml" % repo)
+ bundle_list = glob.glob("%s/Bundler/*.xml" % repo)
+ pkg_list = glob.glob("%s/Pkgmgr/*.xml" % repo)
+ base_list = glob.glob("%s/Base/*.xml" % repo)
+ rules_list = glob.glob("%s/Rules/*.xml" % repo)
+ imageinfo_list = glob.glob("%s/etc/report-configuration.xml" % repo)
+ services_list = glob.glob("%s/Svcmgr/*.xml" % repo)
+ deps_list = glob.glob("%s/Deps/*.xml" % repo)
+
+ filesets = {'metadata':(metadata_list, "%s/metadata.xsd"),
+ 'clients':(clients_list, "%s/clients.xsd"),
+ 'info':(info_list, "%s/info.xsd"),
+ 'bundle':(bundle_list, "%s/bundle.xsd"),
+ 'pkglist':(pkg_list, "%s/pkglist.xsd"),
+ 'base':(base_list, "%s/base.xsd"),
+ 'rules':(rules_list, "%s/rules.xsd"),
+ 'imageinfo':(imageinfo_list, "%s/report-configuration.xsd"),
+ 'services':(services_list, "%s/services.xsd"),
+ 'deps':(deps_list, "%s/deps.xsd")}
failures = 0
- for k, (spec, schemaname) in filesets.iteritems():
+ for k, (filelist, schemaname) in filesets.iteritems():
try:
schema = lxml.etree.XMLSchema(lxml.etree.parse(open(schemaname%(schemadir))))
except:
print "Failed to process schema %s" % (schemaname%(schemadir))
failures = 1
continue
- for filename in glob.glob(spec%(repo)):
+ for filename in filelist:
try:
datafile = lxml.etree.parse(open(filename))
except SyntaxError: