diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-05-12 16:20:04 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-05-12 16:20:04 +0000 |
commit | 99b7eba28856d43d1c7a70551d0974e4a266e5f0 (patch) | |
tree | 1fdcc6d51bad1ad5ff985299717d7f2608e16764 /src | |
parent | c72152956a5088c942c0b99f4e1aed7496aeab73 (diff) | |
download | bcfg2-99b7eba28856d43d1c7a70551d0974e4a266e5f0.tar.gz bcfg2-99b7eba28856d43d1c7a70551d0974e4a266e5f0.tar.bz2 bcfg2-99b7eba28856d43d1c7a70551d0974e4a266e5f0.zip |
Modify bcfg2-repo-validate to warn on xml duplicates (for Ticket #643)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5220 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-x | src/sbin/bcfg2-repo-validate | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/sbin/bcfg2-repo-validate b/src/sbin/bcfg2-repo-validate index 6fb157ec8..62df87447 100755 --- a/src/sbin/bcfg2-repo-validate +++ b/src/sbin/bcfg2-repo-validate @@ -49,7 +49,8 @@ if __name__ == '__main__': metadata_list.append("%s/Metadata/%s" % (repo, filename)) groupdata = lxml.etree.parse("%s/Metadata/%s" % (repo, filename)) group_ents = [ent.get('href') for ent in \ - groupdata.findall('./{http://www.w3.org/2001/XInclude}include')] + groupdata. + findall('./{http://www.w3.org/2001/XInclude}include')] for ent in group_ents: included.add(ent) included.discard(filename) @@ -71,6 +72,27 @@ if __name__ == '__main__': dec_list = glob.glob("%s/Decisions/*" % repo) pkgcfg_list = glob.glob("%s/Packages/config.xml" % repo) + # warn on duplicate Pkgmgr entries with the same priority + pset = set() + for plist in pkg_list: + xdata = lxml.etree.parse(plist) + # get priority, type, group + priority = xdata.getroot().get('priority') + ptype = xdata.getroot().get('type') + for pkg in xdata.findall("//Package"): + if pkg.getparent().tag == 'Group': + grp = pkg.getparent().get('name') + else: + grp = 'none' + ptuple = (pkg.get('name'), priority, ptype, grp) + # check if package is already listed with same priority, + # type, grp + if ptuple in pset: + print("Duplicate Package %s, priority:%s, type:%s"\ + % (pkg.get('name'), priority, ptype)) + else: + pset.add(ptuple) + filesets = {'metadata':(metadata_list, "%s/metadata.xsd"), 'clients':(clients_list, "%s/clients.xsd"), 'info':(info_list, "%s/info.xsd"), |