Changeset 1261


Ignore:
Timestamp:
May 10, 2022, 10:58:52 AM (2 years ago)
Author:
joergs
Message:

extend summary message

Location:
dassldapsync
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • dassldapsync/dassldapsync.conf

    r1221 r1261  
    99#bindPassword=secret
    1010#filter=(objectclass=*)
     11#excludesubtree=ou=unimportant,dc=example,dc=com
    1112#attributes=*
    1213#starttls=true
  • dassldapsync/dassldapsync.py

    r1260 r1261  
    105105    def reset_result(self):
    106106        self.result = {
     107            'unmodified': {'ok': [], 'failed': []},
     108            'excluded': {'ok': [], 'failed': []},
    107109            'add': {'ok': [], 'failed': []},
    108110            'update': {'ok': [], 'failed': []},
     
    149151            d = ldap.cidict.cidict(r[1])
    150152
    151             if self.__is_dn_included(dn):
     153            if not self.__is_dn_included(dn):
     154                self.notify_excluded(dn)
     155            else:
    152156                objectclasses = d["objectclass"]
    153157
     
    280284
    281285    def __syncLdapDestination(self, update_objects):
    282 
    283286        logger.debug("writing data to destination LDAP")
    284287        for obj in update_objects:
     
    339342            ok = len(result[action]['ok'])
    340343            failed = len(result[action]['failed'])
    341             print("{} (ok: {}, failed: {}):".format(action, ok, failed))
    342 
    343             if show_ok and ok > 0:
     344            print("{} (ok: {}, failed: {})".format(action, ok, failed))
     345
     346            if ok > 0 and (show_ok or ok <= 3):
    344347                print("succeeded:")
    345348                print("\n".join(result[action]['ok']))
    346349
    347             if show_failed and failed > 0:
     350            if failed > 0 and (show_failed or failed <= 3):
    348351                print("failed:")
    349352                print("\n".join(result[action]['failed']))
     353            print()
    350354
    351355    def get_short_dn(self, dn):
     
    353357
    354358    def notify_unchanged(self, dn):
    355         logger.debug(u'{} unchanged'.format(self.get_short_dn(dn)))
     359        #logger.debug(u'{} unchanged'.format(self.get_short_dn(dn)))
     360        self.result['unmodified']['ok'].append(dn)
     361
     362    def notify_excluded(self, dn):
     363        #logger.debug(u'{} unchanged'.format(self.get_short_dn(dn)))
     364        self.result['excluded']['ok'].append(dn)
    356365
    357366    def notify_created(self, dn, ok=True):
     
    566575    conffile = args.configfile
    567576
    568     exclude = None
    569 
    570577    config = ConfigParser()
    571578    config.read(conffile)
Note: See TracChangeset for help on using the changeset viewer.