summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-07-05 18:56:10 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-07-05 18:56:10 +0200
commit7b37a35aefab59dfc6f2648ef5a40cbfccc49c7b (patch)
tree04e7eca92a8b1c50f4ec016d580911fcd6e565a5 /src
parent98efabd373da4bdb72c7a9602dc0bf44e83e6b54 (diff)
downloadbcfg2-7b37a35aefab59dfc6f2648ef5a40cbfccc49c7b.tar.gz
bcfg2-7b37a35aefab59dfc6f2648ef5a40cbfccc49c7b.tar.bz2
bcfg2-7b37a35aefab59dfc6f2648ef5a40cbfccc49c7b.zip
bcfg2-admin compare: Don't edit list in for loop
Removing elements from a list while iterating over it (forwards) leads to unexpected results.
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Admin/Compare.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/Server/Admin/Compare.py b/src/lib/Server/Admin/Compare.py
index c62b4a76a..1768223d2 100644
--- a/src/lib/Server/Admin/Compare.py
+++ b/src/lib/Server/Admin/Compare.py
@@ -62,17 +62,19 @@ class Compare(Bcfg2.Server.Admin.Mode):
both = []
oldl = ["%s %s" % (entry.tag, entry.get('name')) for entry in old]
newl = ["%s %s" % (entry.tag, entry.get('name')) for entry in new]
+ onlyold = list(oldl)
+ onlynew = list(newl)
for entry in newl:
if entry in oldl:
both.append(entry)
- newl.remove(entry)
- oldl.remove(entry)
+ onlyold.remove(entry)
+ onlynew.remove(entry)
for entry in both:
print(" %s differs (in bundle %s)" % (entry, name))
- for entry in oldl:
+ for entry in onlyold:
print(" %s only in old configuration (in bundle %s)" % (entry,
name))
- for entry in newl:
+ for entry in onlynew:
print(" %s only in new configuration (in bundle %s)" % (entry,
name))
return False