From 5422db82e3c250add94357a4371c3db31b220be4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 5 Sep 2011 18:10:37 +1000 Subject: s4-s3-upgrade Fix error handling in add_users_to_group --- source4/scripting/python/samba/upgrade.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py index 58be9919ff..7b0c062ce1 100644 --- a/source4/scripting/python/samba/upgrade.py +++ b/source4/scripting/python/samba/upgrade.py @@ -207,8 +207,11 @@ def add_users_to_group(samdb, group, members, logger): try: samdb.modify(m) - except ldb.LdbError, e: - logger.warn("Could not add member to group '%s'", groupmap.nt_name) + 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) + else: + logger.warn("Could not add member '%s' to group '%s': %s", member_sid, group.sid, emsg) def import_wins(samba4_winsdb, samba3_winsdb): -- cgit