From: Frank Brehm Date: Wed, 26 Oct 2022 16:34:40 +0000 (+0200) Subject: Changing debug output X-Git-Tag: 0.7.0^2~1^2~23 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=31051a003c5763ae8f48a8d6176e1e5c3370284b;p=pixelpark%2Fpp-admin-tools.git Changing debug output --- diff --git a/lib/pp_admintools/app/mirror_ldap.py b/lib/pp_admintools/app/mirror_ldap.py index 809ebfa..ea1d9c5 100644 --- a/lib/pp_admintools/app/mirror_ldap.py +++ b/lib/pp_admintools/app/mirror_ldap.py @@ -36,7 +36,7 @@ from .ldap import BaseLdapApplication from ..argparse_actions import NonNegativeItegerOptionAction from ..argparse_actions import LimitedFloatOptionAction -__version__ = '0.5.2' +__version__ = '0.5.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -351,14 +351,6 @@ class MirrorLdapApplication(BaseLdapApplication): for dn in sorted(list(self.tgt_dns_current.keys()), key=cmp_to_key(self.compare_ldap_dns)): - if dn in self.keep_entry_dns: - LOG.debug(_("Entry {!r} is set to be kept.").format(dn)) - continue - - if dn in self.sync_entry_dns: - LOG.debug(_("Entry {!r} is set to be synchronized.").format(dn)) - continue - entry = self.tgt_dns_current[dn] if 'childs' not in entry: LOG.error("Found entry {dn!r}:\n{e}".format(dn=dn, e=pp(entry))) @@ -369,6 +361,15 @@ class MirrorLdapApplication(BaseLdapApplication): "Entry {!r} is a structural entry, will not be removed " "at this point.").format(dn)) continue + + if dn in self.keep_entry_dns: + LOG.debug(_("Entry {!r} is set to be kept.").format(dn)) + continue + + if dn in self.sync_entry_dns: + LOG.debug(_("Entry {!r} is set to be synchronized.").format(dn)) + continue + self.delete_entry(self.tgt_instance, dn) if self.wait_after_write and not self.simulate: time.sleep(self.wait_after_write) @@ -388,7 +389,11 @@ class MirrorLdapApplication(BaseLdapApplication): dns = sorted(list(self.tgt_dns_current.keys()), key=cmp_to_key(self.compare_ldap_dns)) - for dn in list(reversed(dns[1:])): + for dn in list(reversed(dns)): + + entry = self.tgt_dns_current[dn] + if not entry['childs']: + continue if dn in self.keep_entry_dns: LOG.debug(_("Entry {!r} is set to be kept.").format(dn)) @@ -398,9 +403,6 @@ class MirrorLdapApplication(BaseLdapApplication): LOG.debug(_("Entry {!r} is set to be synchronized.").format(dn)) continue - entry = self.tgt_dns_current[dn] - if not entry['childs']: - continue self.delete_entry(self.tgt_instance, dn) if self.wait_after_write and not self.simulate: time.sleep(self.wait_after_write)