summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2008-08-22 02:17:31 +0000
committerSol Jerome <solj@ices.utexas.edu>2008-08-22 02:17:31 +0000
commitd9690cef36daef5884b1b289cfaced2452193c8b (patch)
tree8ee8ba0e5cb990425f9d189d8f32ea2d32d3ce37
parent156950c2f3822ecba05e526d1949f65d364f6675 (diff)
downloadbcfg2-d9690cef36daef5884b1b289cfaced2452193c8b.tar.gz
bcfg2-d9690cef36daef5884b1b289cfaced2452193c8b.tar.bz2
bcfg2-d9690cef36daef5884b1b289cfaced2452193c8b.zip
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
-rwxr-xr-xsrc/sbin/bcfg2-repo-validate21
1 files changed, 21 insertions, 0 deletions
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