From cb6a058e89130141e12ed817d12e8aaf04a3b5eb Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Tue, 9 Mar 2010 00:25:22 +0000 Subject: bcfg2-repo-validate: Add check to verify bundle name attribute Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5757 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-repo-validate | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/sbin/bcfg2-repo-validate') diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate index 33c06dffd..1d16a8148 100755 --- a/src/sbin/bcfg2-repo-validate +++ b/src/sbin/bcfg2-repo-validate @@ -112,7 +112,7 @@ if __name__ == '__main__': 'grouppatterns': (gp_list, "%s/grouppatterns.xsd"), } - failures = 0 + failures = 0 for k, (filelist, schemaname) in list(filesets.items()): try: schema = lxml.etree.XMLSchema(lxml.etree.parse(open(schemaname%(schemadir)))) @@ -159,5 +159,15 @@ if __name__ == '__main__': genshibundle not in allbundles: print("*** Warning: Bundle %s referenced, but does not " "exist." % bundle) + # verify bundle name attribute matches filename + for bundle in (bundle_list + genshibundle_list): + fname = bundle.split('Bundler/')[1].split('.')[0] + xdata = lxml.etree.parse(bundle) + bname = xdata.getroot().get('name') + if fname != bname: + print("The following names are inconsistent:") + print(" Filename is %s" % fname) + print(" Bundle name found in %s is %s" % (fname, bname)) + raise SystemExit, failures -- cgit v1.2.3-1-g7c22