from .config import LDAPMigrationConfiguration
from .idict import CaseInsensitiveDict
-__version__ = '0.6.3'
+__version__ = '0.6.4'
LOG = logging.getLogger(__name__)
CFG_BASENAME = 'ldap-migration.ini'
self.limit = 0
+ self.count_unchanged = 0
+ self.count_added = 0
+ self.count_modified = 0
+
self.object_classes = CaseInsensitiveDict()
self.attribute_types = CaseInsensitiveDict()
self.dns = CaseInsensitiveDict()
print()
LOG.info("Migrating all structural from source to target LDAP cluster.")
+ self.count_unchanged = 0
+ self.count_added = 0
+ self.count_modified = 0
+
self._migrate_entries(self.struct_dns, is_root=True, with_acl=False)
+ total = self.count_unchanged + self.count_added + self.count_modified
+ msg = (
+ "Performed structural entries: {to} total, {ad} added, {mo} modified, "
+ "{un} unchanged.").format(
+ to=total, ad=self.count_added, mo=self.count_modified,
+ un=self.count_unchanged)
+ LOG.info(msg)
+
# -------------------------------------------------------------------------
def generate_target_entry(self, src_entry, src_dn, tgt_dn):
if changes.keys():
return changes
+ self.count_unchanged += 1
if self.verbose:
msg = "No changes on target entry {tdn!r} necessary.".format(tdn=tgt_dn)
LOG.info(msg)
msg = "Changes on target entry {tdn!r}:\n{ch}".format(
tdn=tgt_dn, ch=pp(changes))
LOG.debug(msg)
+ self.count_modified += 1
if not self.simulate:
self.target.modify(tgt_dn, changes)
if wait:
msg += "entry: {en}"
msg = msg.format(dn=tgt_dn, oc=tgt_obj_classes, en=tgt_entry)
LOG.debug(msg)
+ self.count_added += 1
if not self.simulate:
self.target.add(tgt_dn, object_class=tgt_obj_classes, attributes=tgt_entry)
if wait: