s4-s3-upgrade Fix error handling in add_users_to_group
authorAndrew Bartlett <abartlet@samba.org>
Mon, 5 Sep 2011 08:10:37 +0000 (18:10 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 5 Sep 2011 09:19:25 +0000 (11:19 +0200)
source4/scripting/python/samba/upgrade.py

index 58be9919ff7f9eb613cba2386f3255ff6634633d..7b0c062ce12427efc6a00fb3d3442b8a7fd9ec6b 100644 (file)
@@ -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):