from .ldap import BaseLdapApplication
from ..xlate import XLATOR
-__version__ = '0.8.8'
+__version__ = '0.9.0'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
# -------------------------------------------------------------------------
def eval_diffs(self):
"""Evaluate all entries to create, to remove or to modify."""
+ self.empty_line()
LOG.info(_('Evaluating all LDAP entries to create, to remove or to modify.'))
self.eval_entries_to_remove()
return entry
+ # -------------------------------------------------------------------------
+ def _create_ldap_entry_for_create(self, cn):
+ """Generate entry data to create e LDAP entry."""
+ local_alias = self.existing_aliases[cn]
+
+ oclasses = []
+ oclasses.append('inetResource')
+ oclasses.append('mailRecipient')
+ oclasses.append('top')
+
+ attributes = {}
+
+ attributes['cn'] = [cn]
+ attributes['mail'] = [local_alias['alias']]
+ attributes['multiLineDescription'] = []
+ for target in local_alias['targets']:
+ attributes['multiLineDescription'].append(target)
+
+ return (oclasses, attributes)
+
+ # -------------------------------------------------------------------------
+ def add_failing_ldap_entries(self):
+ """Create failing LDAP entries."""
+ self.empty_line()
+ LOG.info(_('Adding failing LDAP aliases ...'))
+ inst = self.ldap_instances[0]
+
+ for cn in self.aliases_to_create:
+ dn = 'cn=' + cn + ',' + self.barracuda_base_dn
+ (oclasses, attributes) = self._create_ldap_entry_for_create(cn)
+ LOG.info(_('Creating LDAP alias {a!r} => {dn!r}.').format(a=cn, dn=dn))
+ # self.add_entry(inst, dn, oclasses, attributes)
+
# -------------------------------------------------------------------------
def _run(self):
self.read_barracuda_ldap_aliases()
self.get_other_ldap_mail_entries()
self.eval_diffs()
+ self.add_failing_ldap_entries()
# =============================================================================