from .idict import CaseInsensitiveDict
from .istringset import CaseInsensitiveStringSet
-__version__ = '0.7.2'
+__version__ = '0.7.3'
LOG = logging.getLogger(__name__)
CFG_BASENAME = 'ldap-migration.ini'
self.count_modified = 0
try:
- self._migrate_entries(self.struct_dns, fh=fh, is_root=True, with_acl=False)
+ self._migrate_entries(
+ self.struct_dns, fh=fh, force=False, is_root=True, with_acl=False)
except (ReadLDAPItemError, WriteLDAPItemError) as e:
msg = "Abort migration: " + str(e)
LOG.error(msg)
return None
# -------------------------------------------------------------------------
- def _migrate_entries(self, cur_hash, fh, is_root=False, with_acl=False):
+ def _migrate_entries(self, cur_hash, fh, force=False, is_root=False, with_acl=False):
wait = self.config.wait_after_write
if not is_root:
src_dn = cur_hash['dn']
- if self.migrate_entry(src_dn, fh=fh, with_acl=with_acl):
+ if self.migrate_entry(src_dn, fh=fh, force=force, with_acl=with_acl):
if wait:
time.sleep(wait)
for key in cur_hash['childs'].keys():
- self._migrate_entries(cur_hash['childs'][key], fh=fh, is_root=False, with_acl=with_acl)
+ self._migrate_entries(
+ cur_hash['childs'][key], fh=fh, force=force, is_root=False, with_acl=with_acl)
# -------------------------------------------------------------------------
- def migrate_entry(self, src_dn, fh, with_acl=False):
+ def migrate_entry(self, src_dn, fh, force=False, with_acl=False):
tgt_dn = self.mangle_dn(src_dn)
rev_dn = self.get_reverse_dn(tgt_dn)
LOG.debug("Migrating source DN {sdn!r} -> {tdn!r}.".format(
sdn=src_dn, tdn=tgt_dn))
- if rev_dn in self.migrated_entries:
+ if not force and rev_dn in self.migrated_entries:
LOG.debug("Entry {!r} is already migrated.".format(tgt_dn))
self.write_result_file(fh, tgt_dn, '-')
return False