misc/scripts/ldap_change_base_dn.py
changeset 5969 caea22e82d83
parent 5968 2e039d1e150c
child 9460 a2a0bc984863
equal deleted inserted replaced
5968:2e039d1e150c 5969:caea22e82d83
    15 for eid, extid in sql("SELECT eid, extid FROM entities WHERE source='%s'" % uri):
    15 for eid, extid in sql("SELECT eid, extid FROM entities WHERE source='%s'" % uri):
    16     olduserdn = b64decode(extid)
    16     olduserdn = b64decode(extid)
    17     newuserdn = olduserdn.replace(olddn, newdn)
    17     newuserdn = olduserdn.replace(olddn, newdn)
    18     if newuserdn != olduserdn:
    18     if newuserdn != olduserdn:
    19         print olduserdn, '->', newuserdn
    19         print olduserdn, '->', newuserdn
    20         sql("UPDATE entities SET extid='%s' WHERE eid=%s" % (b64encode(newdn), eid))
    20         sql("UPDATE entities SET extid='%s' WHERE eid=%s" % (b64encode(newuserdn), eid))
    21 
    21 
    22 commit()
    22 commit()
    23 
    23 
    24 print 'you can now update the sources file to the new dn and restart the instance'
    24 print 'you can now update the sources file to the new dn and restart the instance'