diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-05-22 13:10:14 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-05-22 13:10:14 +0200 |
commit | 91c5c14bd09c7778403227ff4dacaebc4ae222c8 (patch) | |
tree | e0be112a3ff8e368257e71f067fcd47c79ea778d | |
parent | 4a95108d5c911f1a0ff3dc8b4dddee71b70700fc (diff) | |
download | pykolab-91c5c14bd09c7778403227ff4dacaebc4ae222c8.tar.gz |
Make sure we ship the value of the unique attribute back to the callback (#1875)
-rw-r--r-- | pykolab/auth/ldap/syncrepl.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/pykolab/auth/ldap/syncrepl.py b/pykolab/auth/ldap/syncrepl.py index e02e086..03ab5ae 100644 --- a/pykolab/auth/ldap/syncrepl.py +++ b/pykolab/auth/ldap/syncrepl.py @@ -5,8 +5,13 @@ import ldap import ldap.syncrepl import ldapurl +import pykolab + from pykolab import utils +log = pykolab.getLogger('pykolab.syncrepl') +conf = pykolab.getConf() + class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): callback = None @@ -28,16 +33,36 @@ class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer): return self.__db['cookie'] def syncrepl_delete(self, uuids): + log.debug("syncrepl_delete uuids: %r" % (uuids), level=8) + + # Get the unique_attribute name to issue along with our + # callback (if any) + unique_attr = conf.get('ldap', 'unique_attribute') + if unique_attr == None: + unique_attr = 'entryuuid' + + if unique_attr == 'nsuniqueid': + log.warning( + _("The name of the persistent, unique attribute " + \ + "is very probably not compatible with the use of " + \ + "syncrepl.") + ) + + for uuid in uuids: dn = self.__db[uuid] + log.debug("syncrepl_delete dn: %r" % (dn), level=8) + if not self.callback == None: self.callback( change_type='delete', previous_dn=None, change_number=None, dn=dn, - entry={} + entry={ + unique_attr: uuid + } ) del self.__db[uuid] |