change order of LDAP commands and logging to fix log messages

This commit is contained in:
Jan Dittberner 2015-01-29 21:35:33 +01:00
parent ceb1016e8f
commit b0097ea0a5

View file

@ -97,6 +97,8 @@ def create_ldap_user(username, uid, gid, gecos, homedir, shell, password):
if password is not None: if password is not None:
ldapuser.set_password(password) ldapuser.set_password(password)
_LOGGER.info('set password for LDAP user %s', ldapuser.dn) _LOGGER.info('set password for LDAP user %s', ldapuser.dn)
ldapuser.save()
_LOGGER.info('LDAP user %s created', ldapuser.dn)
if ldapuser.username in ldapgroup.members: if ldapuser.username in ldapgroup.members:
_LOGGER.info( _LOGGER.info(
'LDAP user %s is already member of LDAP group %s', 'LDAP user %s is already member of LDAP group %s',
@ -107,8 +109,6 @@ def create_ldap_user(username, uid, gid, gecos, homedir, shell, password):
_LOGGER.info( _LOGGER.info(
'LDAP user %s has been added to LDAP group %s', 'LDAP user %s has been added to LDAP group %s',
ldapuser.dn, ldapgroup.dn) ldapuser.dn, ldapgroup.dn)
ldapuser.save()
_LOGGER.info('LDAP user %s created', ldapuser.dn)
return ldapuser.dn return ldapuser.dn