Merge lp:~milo/linaro-patchmetrics/crowd-teams into lp:linaro-patchmetrics
Status: | Merged |
---|---|
Merged at revision: | 379 |
Proposed branch: | lp:~milo/linaro-patchmetrics/crowd-teams |
Merge into: | lp:linaro-patchmetrics |
Diff against target: |
524 lines (+395/-19) 4 files modified
apps/patchmetrics/bin/get-linaro-membership.py (+25/-7) apps/patchmetrics/crowd.py (+238/-0) apps/patchmetrics/utils.py (+122/-7) apps/settings.py (+10/-5) |
To merge this branch: | bzr merge lp:~milo/linaro-patchmetrics/crowd-teams |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Sokolovsky | Approve | ||
Linaro Automation & Validation | Pending | ||
Review via email:
|
Description of the change
The following MP is the starting work to move away from Launchpad and use Crowd in patchwork/
Here the Launchpad teams extraction has been reworked in order to interact with Crowd API. Launchpad integration has not been removed, and Crowd integration at the moment is commented out. When we roll out the final changes to patchwork/
What has been done:
- Introduced a Crowd class, that handles the connection to the Crowd API and that perform basic queries for the scope needed (users).
- Introduced a CrowdUser class that returns a handy Python object for a Crowd user as extracted from the Crowd API.
Two new variables in settings.py have been introduced: one is necessary to configure the Crowd integration, and it needs a user, password, url, and optional port to connect to the Crowd API. The file is a INI-style file, with a [crowd] section.
The second variable, optional, is to define a text file with whitelisted groups. Since when we retrieve a user information we get all the groups she is a member of, we might end up creating too many groups in patchwork/
There are two things still missing:
- Extracting or constructing a team display_name attribute: this is needed when creating new teams to give them a better visible name. Unfortunately Crowd does not expose that information, and we might need to use LDAP to achieve that.
- Modifying the 'sync_openid_urls' function: this function is called when syncing teams and users, and patchmetrics creates new users. The function patch the DB with a openid login URL from Launchpad. That needs to be modified to match the Linaro Login URL, but it should be done when we switch the authentication to Crowd too.
I have few concerns with crowd.py:
1. it doesn't follow DRY, for example has "/crowd/ rest/usermanage ment/1" twice (even rough example for Crowd API access addressed that providing layered functions for API calls).
2. I find "login_with" to be pretty confusing name for a factory method. It rather would be called something like "connect", though I don't understand why that work can't be done in old good constructor.
3. "Impossible to fulfill the request")
264 + elif resp.status == 401 or resp.status == 403:
265 + raise CrowdException(
403 is rather important HTTP result code to shove it together with any other code, especially not mentioning "forbidden" explicitly in a result.
4. Crowd credentials storage scheme is not compatible with django- crowd-backend which would be used for user auth support.
I'd suggest to do something about 3. before merging. Otherwise, based on the discussion in the email (i.e. confirming it was tested), this can go in, so we'll definitely need to address 4 later.