summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-01-25 16:50:11 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-01-25 16:50:11 +0000
commit13c6495e5b8412dd9af7a4cf10eb2f0abd098e4f (patch)
treeac170dd241e5854dbca2ff1e276e117cfec567c9 /tools
parente3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92 (diff)
downloadbcfg2-13c6495e5b8412dd9af7a4cf10eb2f0abd098e4f.tar.gz
bcfg2-13c6495e5b8412dd9af7a4cf10eb2f0abd098e4f.tar.bz2
bcfg2-13c6495e5b8412dd9af7a4cf10eb2f0abd098e4f.zip
fix crosschecker in cases where entries appear multiple times (from RickB)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1718 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools')
-rw-r--r--tools/crosscheck.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/tools/crosscheck.py b/tools/crosscheck.py
index 034fb1a90..a32d10e2a 100644
--- a/tools/crosscheck.py
+++ b/tools/crosscheck.py
@@ -10,27 +10,26 @@ important = {'Package':['name', 'version'],
'ConfigFile':['name', 'owner', 'group', 'perms']}
def compare(new, old):
- for child in new.getchildren():
- equiv = old.xpath('%s[@name="%s"]' % (child.tag, child.get('name')))
- if not important.has_key(child.tag):
- print "tag type %s not handled" % (child.tag)
- continue
- if len(equiv) == 0:
- print "didn't find matching %s %s" % (child.tag, child.get('name'))
- continue
- elif len(equiv) == 1:
- if child.tag == 'ConfigFile':
- if child.text != equiv[0].text:
- continue
- if [child.get(field) for field in important[child.tag]] == \
- [equiv[0].get(field) for field in important[child.tag]]:
- new.remove(child)
- old.remove(equiv[0])
- else:
- print "+", lxml.etree.tostring(child),
- print "-", lxml.etree.tostring(equiv[0]),
- else:
- print "tag %s.%s listed > 1?" % (child.tag, child.get('name'))
+ for i in range(2): #this is hardcoded.. may be a better looping
+ method
+ for child in new.getchildren():
+ equiv = old.xpath('%s[@name="%s"]' % (child.tag,
+ child.get('name')))
+ if not important.has_key(child.tag):
+ print "tag type %s not handled" % (child.tag)
+ continue
+ if len(equiv) == 0:
+ print "didn't find matching %s %s" % (child.tag,
+ child.get('name'))
+ continue
+ elif len(equiv) >= 1:
+ if child.tag == 'ConfigFile':
+ if child.text != equiv[0].text:
+ continue
+ if [child.get(field) for field in
+ important[child.tag]] == \
+ [equiv[0].get(field) for field in
+ important[child.tag]]:
if len(old.getchildren()) == 0 and len(new.getchildren()) == 0:
return True
if new.tag == 'Independant':