[Freeipa-devel] [freeipa/freeipa #3] User add fix #6199 (comment)

freeipa-github-notification at redhat.com freeipa-github-notification at redhat.com
Mon Aug 22 05:33:31 UTC 2016


jcholast commented on a pull request

This is not very comprehensible. I would rather replace the:
```python
    dn = self.obj.get_either_dn(*keys, **options)
```
at the beginning of `user_add.pre_callback` with:
```python
    delete_dn = self.obj.get_delete_dn(*keys, **options)
    try:
        ldap.get_entry(delete_dn, [''])
    except errors.NotFound:
        pass
    else:
        self.obj.handle_duplicate_entry(*keys)
```
Note that this assumes that the routine to get `delete_dn` was split off from `user.get_either_dn()` into `user.get_delete_dn()` to avoid copy-pasta.

See the full comment at https://github.com/freeipa/freeipa/pull/3#issuecomment-241318444


More information about the Freeipa-devel mailing list