From d9690cef36daef5884b1b289cfaced2452193c8b Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 22 Aug 2008 02:17:31 +0000 Subject: Add warning for missing bundles in bcfg2-repo-validate (Resolves Ticket #579) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4888 ce84e21b-d406-0410-9b95-82705330c041 --- src/sbin/bcfg2-repo-validate | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/sbin') diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate index ee5d74487..d067d4e74 100755 --- a/src/sbin/bcfg2-repo-validate +++ b/src/sbin/bcfg2-repo-validate @@ -31,6 +31,14 @@ if __name__ == '__main__': if filename.endswith('info.xml'): info_list.append(os.path.join(root, filename)) + # get all XIncluded bundles + ref_bundles = [] + unref_bundles = [] + xdata = lxml.etree.parse("%s/Metadata/groups.xml" % repo) + xdata.xinclude() + for bundle in xdata.findall("//Bundle"): + ref_bundles.append("%s/Bundler/%s.xml" % (repo,bundle.get('name'))) + # 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) @@ -42,6 +50,11 @@ if __name__ == '__main__': services_list = glob.glob("%s/Svcmgr/*.xml" % repo) deps_list = glob.glob("%s/Deps/*.xml" % repo) + # find all unreferenced bundles + for bundle in ref_bundles: + if bundle not in bundle_list: + unref_bundles.append(bundle) + filesets = {'metadata':(metadata_list, "%s/metadata.xsd"), 'clients':(clients_list, "%s/clients.xsd"), 'info':(info_list, "%s/info.xsd"), @@ -87,4 +100,12 @@ if __name__ == '__main__': (schemaname % schemadir, filename)) elif verbose: print "%s checks out" % (filename) + + # print out missing bundle information + if verbose: + print("") + for bundle in unref_bundles: + print ("*** Warning: Bundle %s referenced, but does not " + "exist." % bundle) + raise SystemExit, failures -- cgit v1.2.3-1-g7c22