summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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):