Skip to content

Commit b641b88

Browse files
committed
ignore if email record wasn't found
1 parent 480303f commit b641b88

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

m3_sync.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ def main(self):
189189
email = getattr(
190190
self.ldap.entries[0], self.sync['mail_attr']).value
191191

192-
if 'replace_mail_domain' in self.sync and self.sync['replace_mail_domain']:
193-
email = re.sub(r'@.*?$', '@{}'.format(self.sync['replace_mail_domain']), email)
192+
if not email:
193+
self.logger.warning('LDAP data for {}, is not an email or it doesn\'t has email attribute'.format(dn))
194+
continue
195+
196+
if 'replace_mail_domain' in self.sync and self.sync['replace_mail_domain']:
197+
email = re.sub(r'@.*?$', '@{}'.format(self.sync['replace_mail_domain']), email)
194198

195199
# lower case the email
196200
ldap_data[self.get_list(list_name)][attr].append(

0 commit comments

Comments
 (0)