summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-07-05 23:34:01 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-07-05 23:34:01 +0200
commit63bfad7896af8e463fe2278528fe1c9e2e87d623 (patch)
tree5f472d52e3cf39de8487590b3b1c6b20b28574dc /src
parent66b3038124bcf29969f47845b5de8fae47ccb01e (diff)
downloadbcfg2-63bfad7896af8e463fe2278528fe1c9e2e87d623.tar.gz
bcfg2-63bfad7896af8e463fe2278528fe1c9e2e87d623.tar.bz2
bcfg2-63bfad7896af8e463fe2278528fe1c9e2e87d623.zip
bcfg2-admin compare: Some code cleanups
... in the compareSpecifications() method.
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Admin/Compare.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/lib/Server/Admin/Compare.py b/src/lib/Server/Admin/Compare.py
index 19a0bf002..575da71f5 100644
--- a/src/lib/Server/Admin/Compare.py
+++ b/src/lib/Server/Admin/Compare.py
@@ -89,34 +89,30 @@ class Compare(Bcfg2.Server.Admin.Mode):
if bundle.get('name')[-4:] == '.xml':
bundle.set('name', bundle.get('name')[:-4])
- rcs = []
+ identical = True
+
for bundle in old.findall('./Bundle'):
if len(new.xpath('Bundle[@name="%s"]' % (bundle.get('name')))) == 0:
print("Bundle %s only in old configuration" %
bundle.get('name'))
- rcs.append(False)
+ identical = False
for bundle in new.findall('./Bundle'):
equiv = old.xpath('Bundle[@name="%s"]' % (bundle.get('name')))
if len(equiv) == 0:
- print("couldnt find matching bundle for %s" % bundle.get('name'))
- continue
- if len(equiv) == 1:
- if self.compareStructures(bundle, equiv[0]):
- new.remove(bundle)
- old.remove(equiv[0])
- rcs.append(True)
- else:
- rcs.append(False)
- else:
- print("Unmatched bundle %s" % (bundle.get('name')))
- rcs.append(False)
+ print("Bundle %s only in new configuration" %
+ bundle.get('name'))
+ identical = False
+ elif not self.compareStructures(bundle, equiv[0]):
+ identical = False
+
i1 = lxml.etree.Element('Independent')
i2 = lxml.etree.Element('Independent')
i1.extend(new.findall('./Independent/*'))
i2.extend(old.findall('./Independent/*'))
if not self.compareStructures(i1, i2):
- rcs.append(False)
- return False not in rcs
+ identical = False
+
+ return identical
def __call__(self, args):
Bcfg2.Server.Admin.Mode.__call__(self, args)