mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
s3_upgrade: Let python generate backtrace for unknown exceptions
Catch known exceptions only. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
886203f3bc
commit
7f67d7b5ca
@ -162,16 +162,11 @@ def add_idmap_entry(idmapdb, sid, xid, xid_type, logger):
|
|||||||
|
|
||||||
# First try to see if we already have this entry
|
# First try to see if we already have this entry
|
||||||
found = False
|
found = False
|
||||||
try:
|
msg = idmapdb.search(expression='objectSid=%s' % str(sid))
|
||||||
msg = idmapdb.search(expression='objectSid=%s' % str(sid))
|
if msg.count == 1:
|
||||||
if msg.count == 1:
|
found = True
|
||||||
found = True
|
|
||||||
except Exception, e:
|
|
||||||
raise e
|
|
||||||
|
|
||||||
if found:
|
if found:
|
||||||
print msg.count
|
|
||||||
print dir(msg)
|
|
||||||
try:
|
try:
|
||||||
m = ldb.Message()
|
m = ldb.Message()
|
||||||
m.dn = ldb.Dn(idmapdb, msg[0]['dn'])
|
m.dn = ldb.Dn(idmapdb, msg[0]['dn'])
|
||||||
@ -181,8 +176,6 @@ def add_idmap_entry(idmapdb, sid, xid, xid_type, logger):
|
|||||||
except ldb.LdbError, e:
|
except ldb.LdbError, e:
|
||||||
logger.warn('Could not modify idmap entry for sid=%s, id=%s, type=%s (%s)',
|
logger.warn('Could not modify idmap entry for sid=%s, id=%s, type=%s (%s)',
|
||||||
str(sid), str(xid), xid_type, str(e))
|
str(sid), str(xid), xid_type, str(e))
|
||||||
except Exception, e:
|
|
||||||
raise e
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
idmapdb.add({"dn": "CN=%s" % str(sid),
|
idmapdb.add({"dn": "CN=%s" % str(sid),
|
||||||
@ -243,8 +236,6 @@ def add_group_from_mapping_entry(samdb, groupmap, logger):
|
|||||||
found = False
|
found = False
|
||||||
else:
|
else:
|
||||||
raise ldb.LdbError(ecode, emsg)
|
raise ldb.LdbError(ecode, emsg)
|
||||||
except Exception, e:
|
|
||||||
raise e
|
|
||||||
|
|
||||||
if found:
|
if found:
|
||||||
logger.warn('Group already exists sid=%s, groupname=%s existing_groupname=%s, Ignoring.',
|
logger.warn('Group already exists sid=%s, groupname=%s existing_groupname=%s, Ignoring.',
|
||||||
@ -287,8 +278,6 @@ def add_users_to_group(samdb, group, members, logger):
|
|||||||
samdb.modify(m)
|
samdb.modify(m)
|
||||||
except ldb.LdbError, e:
|
except ldb.LdbError, e:
|
||||||
logger.warn("Could not add member to group '%s'", groupmap.nt_name)
|
logger.warn("Could not add member to group '%s'", groupmap.nt_name)
|
||||||
except Exception, e:
|
|
||||||
raise(e)
|
|
||||||
|
|
||||||
|
|
||||||
def import_wins(samba4_winsdb, samba3_winsdb):
|
def import_wins(samba4_winsdb, samba3_winsdb):
|
||||||
@ -554,7 +543,7 @@ def upgrade_from_samba3(samba3, logger, session_info, smbconf, targetdir):
|
|||||||
# Get domain sid
|
# Get domain sid
|
||||||
try:
|
try:
|
||||||
domainsid = passdb.get_global_sam_sid()
|
domainsid = passdb.get_global_sam_sid()
|
||||||
except:
|
except passdb.error:
|
||||||
raise Exception("Can't find domain sid for '%s', Exiting." % domainname)
|
raise Exception("Can't find domain sid for '%s', Exiting." % domainname)
|
||||||
|
|
||||||
# Get machine account, sid, rid
|
# Get machine account, sid, rid
|
||||||
|
Reference in New Issue
Block a user