summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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