]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Don't migrating Samba Computer entries
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Jan 2021 16:35:39 +0000 (17:35 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Jan 2021 16:35:39 +0000 (17:35 +0100)
lib/ldap_migration/__init__.py

index 7f5ef4ff12ebf3e7ce580759c736f6f4955a83b0..8f948b4390a269926802bf0f2265d9e3c2728a49 100644 (file)
@@ -45,7 +45,7 @@ from fb_tools.collections import CIStringSet, CIDict
 
 from .config import LDAPMigrationConfiguration
 
-__version__ = '0.9.9'
+__version__ = '0.9.10'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
@@ -173,6 +173,8 @@ class LDAPMigrationApplication(BaseApplication):
     re_token_split = re.compile(r'^\s*([a-z0-9]+)\s*=\s*(\S(?:.*\S)?)\s*$', re.IGNORECASE)
     re_plus_in_cn = re.compile(r'(?P<before>\S)(?:\s+\+\s+|\s+\+|\+\s+)\s*(?P<after>\S)')
 
+    rev_dn_samba_computers = 'o=isp:o=pixelpark:ou=Applications:ou=Unix NSS:ou=SambaComputers'
+
     tz = get_localzone()
 
     # -------------------------------------------------------------------------
@@ -1571,6 +1573,13 @@ class LDAPMigrationApplication(BaseApplication):
 
         tgt_dn = self.mangle_dn(src_dn)
         rev_dn = self.get_reverse_dn(tgt_dn)
+
+        if (rev_dn.lower().startswith(self.rev_dn_samba_computers.lower()) and
+                tgt_dn.lower().startswith('uid=')):
+            LOG.info("Entry {!r} is a Samba Computer entry and will not be migrated.".format(
+                src_dn))
+            return False
+
         LOG.debug("Migrating source DN {sdn!r} -> {tdn!r}.".format(
             sdn=src_dn, tdn=tgt_dn))