4teamwork/opengever.core — pull request #623 by lukasgraf (2014-10-14 10:25:37+00:00)
Title: Unify OGDS sync implementation

This PR unifies the implementation of OGDS synchronization.

Previously, there were three different places where OGDS synchronization was done:
- From cron jobs on deployments
- On site setups
- Triggered manually via the `@@sync_user` and `@@sync_group` views

All three ways used slightly different implementations of the actual synchronization process.

This PR changes this, so that there's one single [`sync_ogds()`](https://github.com/4teamwork/opengever.core/blob/e98723b9bdea80e289317751517a95fb3af707f0/opengever/ogds/base/sync/ogds_updater.py#L28-57) function that is clean, and flexible enough to be used from everywhere where it's needed.

Additionally, a zopectl command has been added for easy use from cron-jobs:
```
bin/instance sync_ogds
```

Overview of changes in this PR:

- Removed shell script that was used as a wrapper / helper for creating cron jobs. Didn't work in all setups, and is not used any more
- Moved (and slightly modified) some debughelpers from `opengever.maintenance` to `opengever.core.debughelpers`
- Cleaned up logging:
- All three ways to trigger OGDS synchronization should now log *the same output*
- Removed redundant `WARNING` from some messages
- Made some existing logged lines more explicit and useful. Instead of `Importing user 'john.doe'...` we now log `Importing user 'john.doe' into group 'mandant1_users'...`
- Logging a single line when starting to import a new group, so the process can be followed more easily
- Generally speaking, OGDS sync logging is definitely on the verbose side. But I'd rather have more than less info when something doesn't work as excpected, and we can always tune it down later.
- Renamed the `og.ogds.base.ldap_import` sub-package to `og.ogds.base.sync` and put everything related to OGDS sync inside it (`ldap_util.py` specifically)
- Renamed the browser views `@@sync_user` and `@@sync_group` to `@@sync_users` and `@@sync_groups`
- Added a `bin/instance sync_ogds` zopectl command
- The remote import stamp is now *always* updated when syncing

@phgross