Merge lp:~stevenk/launchpad/remove-unused-sharing-garbo into lp:launchpad
Proposed by
Steve Kowalik
on 2012-08-22
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Steve Kowalik on 2012-08-22 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 15856 | ||||
| Proposed branch: | lp:~stevenk/launchpad/remove-unused-sharing-garbo | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
195 lines (+86/-1) 6 files modified
database/schema/security.cfg (+2/-0) lib/lp/code/model/branchnamespace.py (+1/-0) lib/lp/registry/interfaces/accesspolicy.py (+3/-0) lib/lp/registry/model/accesspolicy.py (+5/-0) lib/lp/scripts/garbo.py (+59/-1) lib/lp/scripts/tests/test_garbo.py (+16/-0) |
||||
| To merge this branch: | bzr merge lp:~stevenk/launchpad/remove-unused-sharing-garbo | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2012-08-22 | Approve on 2012-08-22 |
|
Review via email:
|
|||
Commit Message
Add a daily garbo job that will trawl all products and remove all access policies that are unused.
Description of the Change
Add a daily garbo job that will trawl all products and remove all access policies that are unused. I've tried to minimize the queries used, and make use of the accesspolicy methods.
To post a comment you must log in.
| William Grant (wgrant) wrote : | # |
Could you a docstring to the TunableLoop and perhaps some comments describing what it's doing and why? Apart from that it's fine.
review:
Approve
(code)

122 + allowed_ bug_policies = set( ALLOWED_ TYPES.get( product. bug_sharing_ policy, [])) branch_ policies = set( POLICY_ ALLOWED_ TYPES.get( branch_ sharing_ policy, []))
123 + BUG_POLICY_
124 + allowed_
125 + BRANCH_
126 + product.
You'll need to either exclude those with *_sharing_policy unset, or default to FREE_INFORMATIO N_TYPES, otherwise all legacy-configured projects will have their builtin APs reaped.
127 + access_polices = set(
Does it really?
131 + apas = getUtility( IAccessPolicyAr tifactSource) .findByPolicy(
132 + candidate_aps)
133 + used_aps = set([apa.policy for apa in apas])
This is going to load potentially hundreds of thousands of objects, which is probably not what you want.