]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Display syntax rule for each attribute type
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 8 Jan 2021 07:10:26 +0000 (08:10 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 8 Jan 2021 07:10:26 +0000 (08:10 +0100)
lib/ldap_migration/__init__.py

index 76fe29eb53118ec305e1438b0726fed587b72b33..d55575fd1edf2bb55df720ba655f28a81cf1a269 100644 (file)
@@ -45,7 +45,7 @@ from fb_tools.collections import CIStringSet, CIDict
 
 from .config import LDAPMigrationConfiguration
 
-__version__ = '0.9.11'
+__version__ = '0.9.12'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
@@ -177,6 +177,74 @@ class LDAPMigrationApplication(BaseApplication):
 
     tz = get_localzone()
 
+    syntax = {
+        '1.2.36.79672281.1.5.0': 'RDN',
+        '1.3.6.1.1.1.0.0': 'NIS Netgroup Triple',
+        '1.3.6.1.1.1.0.1': 'Boot Parameter',
+        '1.3.6.1.1.16.1': 'UUID',
+        '1.3.6.1.4.1.1466.115.121.1.1': 'ACI Item',
+        '1.3.6.1.4.1.1466.115.121.1.2': 'Access Point',
+        '1.3.6.1.4.1.1466.115.121.1.3': 'Attribute Type Description',
+        '1.3.6.1.4.1.1466.115.121.1.4': 'Audio Binary',
+        '1.3.6.1.4.1.1466.115.121.1.5': 'Binary',
+        '1.3.6.1.4.1.1466.115.121.1.6': 'Bit String',
+        '1.3.6.1.4.1.1466.115.121.1.7': 'Boolean',
+        '1.3.6.1.4.1.1466.115.121.1.8': 'Certificate',
+        '1.3.6.1.4.1.1466.115.121.1.9': 'Certificate List',
+        '1.3.6.1.4.1.1466.115.121.1.10': 'Certificate Pair',
+        '1.3.6.1.4.1.1466.115.121.1.11': 'Country String',
+        '1.3.6.1.4.1.1466.115.121.1.12': 'Distinguished Name',
+        '1.3.6.1.4.1.1466.115.121.1.13': 'Data Quality Syntax',
+        '1.3.6.1.4.1.1466.115.121.1.14': 'Delivery Method',
+        '1.3.6.1.4.1.1466.115.121.1.15': 'DirectoryString',
+        '1.3.6.1.4.1.1466.115.121.1.16': 'DIT Content Rule Description',
+        '1.3.6.1.4.1.1466.115.121.1.17': 'DIT Structure Rule Description',
+        '1.3.6.1.4.1.1466.115.121.1.18': 'DL Submit Permission',
+        '1.3.6.1.4.1.1466.115.121.1.19': 'DSA Quality Syntax',
+        '1.3.6.1.4.1.1466.115.121.1.20': 'DSE Type',
+        '1.3.6.1.4.1.1466.115.121.1.21': 'Enhanced Guide',
+        '1.3.6.1.4.1.1466.115.121.1.22': 'Facsimile Telephone Number',
+        '1.3.6.1.4.1.1466.115.121.1.23': 'FAX',
+        '1.3.6.1.4.1.1466.115.121.1.24': 'Generalized Time',
+        '1.3.6.1.4.1.1466.115.121.1.25': 'Guide',
+        '1.3.6.1.4.1.1466.115.121.1.26': 'IA5String 7-Bit-ASCII',
+        '1.3.6.1.4.1.1466.115.121.1.27': 'Integer',
+        '1.3.6.1.4.1.1466.115.121.1.28': 'JPEG',
+        '1.3.6.1.4.1.1466.115.121.1.29': 'Master And Shadow Access Points',
+        '1.3.6.1.4.1.1466.115.121.1.30': 'Matching Rule Description',
+        '1.3.6.1.4.1.1466.115.121.1.31': 'Matching Rule Use Description',
+        '1.3.6.1.4.1.1466.115.121.1.32': 'Mail Preference',
+        '1.3.6.1.4.1.1466.115.121.1.33': 'MHS OR Address',
+        '1.3.6.1.4.1.1466.115.121.1.34': 'Name And Optional UID',
+        '1.3.6.1.4.1.1466.115.121.1.35': 'Name Form Description',
+        '1.3.6.1.4.1.1466.115.121.1.36': 'Numeric String',
+        '1.3.6.1.4.1.1466.115.121.1.37': 'Object Class Description',
+        '1.3.6.1.4.1.1466.115.121.1.38': 'OID',
+        '1.3.6.1.4.1.1466.115.121.1.39': 'Other Mailbox',
+        '1.3.6.1.4.1.1466.115.121.1.40': 'OctetString',
+        '1.3.6.1.4.1.1466.115.121.1.41': 'Postal Address',
+        '1.3.6.1.4.1.1466.115.121.1.42': 'Protocol Information',
+        '1.3.6.1.4.1.1466.115.121.1.43': 'Presentation Address',
+        '1.3.6.1.4.1.1466.115.121.1.44': 'Printable String',
+        '1.3.6.1.4.1.1466.115.121.1.45': 'SubtreeSpecification',
+        '1.3.6.1.4.1.1466.115.121.1.46': 'Supplier Information',
+        '1.3.6.1.4.1.1466.115.121.1.47': 'Supplier Or Consumer',
+        '1.3.6.1.4.1.1466.115.121.1.48': 'Supplier And Consumer',
+        '1.3.6.1.4.1.1466.115.121.1.49': 'Supported Algorithm',
+        '1.3.6.1.4.1.1466.115.121.1.50': 'TelephoneNumber',
+        '1.3.6.1.4.1.1466.115.121.1.51': 'Teletex Terminal Identifier',
+        '1.3.6.1.4.1.1466.115.121.1.52': 'Telex Number',
+        '1.3.6.1.4.1.1466.115.121.1.53': 'UTC Time',
+        '1.3.6.1.4.1.1466.115.121.1.54': 'LDAP Syntax Description',
+        '1.3.6.1.4.1.1466.115.121.1.55': 'Modify Rights',
+        '1.3.6.1.4.1.1466.115.121.1.56': 'LDAP Schema Definition',
+        '1.3.6.1.4.1.1466.115.121.1.57': 'LDAP Schema Description',
+        '1.3.6.1.4.1.1466.115.121.1.58': 'Substring Assertion',
+        '1.3.6.1.4.1.4203.666.2.1': 'OpenLDAP ACI',
+        '1.3.6.1.4.1.4203.666.2.7': 'authzSyntax',
+        '1.3.6.1.4.1.4203.666.11.10.2.1': 'X.509 AttributeCertificate',
+    }
+
     # -------------------------------------------------------------------------
     def __init__(
             self, appname=None, verbose=0, version=__version__, base_dir=None):
@@ -953,7 +1021,19 @@ class LDAPMigrationApplication(BaseApplication):
             if self.verbose > 3:
                 LOG.debug("Discovered AttributeTypes:\n" + pp(self.attribute_types.as_dict()))
             else:
-                LOG.debug("Discovered AttributeTypes:\n" + pp(list(self.attribute_types.keys())))
+                max_len = 1
+                for at in self.attribute_types.keys():
+                    if len(at) > max_len:
+                        max_len = len(at)
+                tpl = "{{n:<{m}}}  - {{s}}".format(m=max_len)
+                atlist = []
+                for at in self.attribute_types.keys():
+                    stx = '<unknown syntax>'
+                    stx_oid = self.attribute_types[at]['syntax']
+                    if stx_oid in self.syntax:
+                        stx = self.syntax[stx_oid]
+                    atlist.append(tpl.format(n=at, s=stx))
+                LOG.debug("Discovered AttributeTypes:\n" + pp(atlist))
 
     # -------------------------------------------------------------------------
     def discover_integer_attribute_types(self):
@@ -1822,7 +1902,7 @@ class LDAPMigrationApplication(BaseApplication):
             self.get_all_dns()
             self.get_structural_dns()
             self.migrate_entries()
-            self.detailled_summary()
+            self.detailled_summary()
 
         finally:
             self.disconnect()