summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-09-06 08:14:35 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-09-07 02:22:56 +0200
commita9a3a79767401ba1165fde9aeb8820c012ef5470 (patch)
treeab2e5d3a3ac3b15f167613dd78b8f830a8e11d01
parent02da47d75c4cbf977ad70d75f20e4d6100907cdc (diff)
downloadsamba-a9a3a79767401ba1165fde9aeb8820c012ef5470.tar.gz
samba-a9a3a79767401ba1165fde9aeb8820c012ef5470.tar.bz2
samba-a9a3a79767401ba1165fde9aeb8820c012ef5470.zip
s4-s3-upgrade Handle expected errors, error out on unexpected ones
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Sep 7 02:22:56 CEST 2011 on sn-devel-104
-rw-r--r--source4/scripting/python/samba/upgrade.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 7e16eeee2c..2bb5ccccbe 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -208,10 +208,12 @@ def add_users_to_group(samdb, group, members, logger):
try:
samdb.modify(m)
except ldb.LdbError, (ecode, emsg):
- if ecode == ldb.ERR_NO_SUCH_OBJECT:
- logger.warn("Could not add member '%s' to group '%s' as either group or user record doesn't exist: %s", member_sid, group.sid, emsg)
+ if ecode == ldb.ERR_ENTRY_ALREADY_EXISTS:
+ logger.info("skipped re-adding member '%s' to group '%s': %s", member_sid, group.sid, emsg)
+ elif ecode == ldb.ERR_NO_SUCH_OBJECT:
+ raise ProvisioningError("Could not add member '%s' to group '%s' as either group or user record doesn't exist: %s" % (member_sid, group.sid, emsg))
else:
- logger.warn("Could not add member '%s' to group '%s': %s", member_sid, group.sid, emsg)
+ raise ProvisioningError("Could not add member '%s' to group '%s': %s" % (member_sid, group.sid, emsg))
def import_wins(samba4_winsdb, samba3_winsdb):