summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-01-05 02:48:03 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-01-05 03:37:35 +0100
commit26c8a520f3284391820424df2bf4158b276dd32b (patch)
tree60000b2c6c8e092fbd0394806c8ba0d689caaac2
parente80b322077d132c8973e85d25ef40c956e8f5b54 (diff)
downloadsamba-26c8a520f3284391820424df2bf4158b276dd32b.tar.gz
samba-26c8a520f3284391820424df2bf4158b276dd32b.tar.bz2
samba-26c8a520f3284391820424df2bf4158b276dd32b.zip
upgradeprovision: Fix use of dict.get().
Avoid modifying list while iterating over it. Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Wed Jan 5 03:37:35 CET 2011 on sn-devel-104
-rwxr-xr-xsource4/scripting/bin/upgradeprovision16
1 files changed, 5 insertions, 11 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 27e142b058..36c99ee649 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -855,19 +855,13 @@ def update_present(ref_samdb, samdb, basedn, listPresent, usns, invocationid):
isFirst = 0
txt = ""
- for att in delta:
+ for att in list(delta):
if usns is not None:
# We have updated by provision usn information so let's exploit
# replMetadataProperties
if att in forwardlinked:
- if current[0].get():
- curval = current[0][att]
- else:
- curval = ()
- if reference[0].get():
- refval = reference[0][att]
- else:
- refval = ()
+ curval = current[0].get(att, ())
+ refval = reference[0].get(att, ())
handle_links(samdb, att, basedn, current[0]["dn"],
curval, refval, delta)
continue
@@ -1696,8 +1690,8 @@ if __name__ == '__main__':
for att in deltaattr:
if att.lower() == "dn":
continue
- if deltaattr.get(att) is not None \
- and deltaattr.get(att).flags() != FLAG_MOD_ADD:
+ if (deltaattr.get(att) is not None
+ and deltaattr.get(att).flags() != FLAG_MOD_ADD):
doit = False
elif deltaattr.get(att) is None:
doit = False