launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06726
[Merge] lp:~stevenk/launchpad/drop-garbo-accesspolicy-redux into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/drop-garbo-accesspolicy-redux into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/drop-garbo-accesspolicy-redux/+merge/97779
Drop AccessPolicy{Distribution,Product}Addition. Thank them for their sterling work by removing them from the code base. This time for reals, since AccessPolicy rows are inserted when new products and distributions are created.
--
https://code.launchpad.net/~stevenk/launchpad/drop-garbo-accesspolicy-redux/+merge/97779
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/drop-garbo-accesspolicy-redux into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2012-03-09 01:25:12 +0000
+++ database/schema/security.cfg 2012-03-16 00:48:19 +0000
@@ -2105,7 +2105,6 @@
[garbo]
groups=script,read
-public.accesspolicy = SELECT, INSERT
public.account = SELECT, DELETE
public.answercontact = SELECT, DELETE
public.branch = SELECT, UPDATE
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2012-03-14 03:12:52 +0000
+++ lib/lp/scripts/garbo.py 2012-03-16 00:48:19 +0000
@@ -13,7 +13,6 @@
datetime,
timedelta,
)
-import itertools
import logging
import multiprocessing
import os
@@ -27,12 +26,7 @@
import iso8601
from psycopg2 import IntegrityError
import pytz
-from storm.expr import (
- Exists,
- In,
- Not,
- Select,
- )
+from storm.expr import In
from storm.locals import (
Max,
Min,
@@ -63,12 +57,7 @@
RevisionCache,
)
from lp.hardwaredb.model.hwdb import HWSubmission
-from lp.registry.enums import InformationType
-from lp.registry.interfaces.accesspolicy import IAccessPolicySource
-from lp.registry.model.accesspolicy import AccessPolicy
-from lp.registry.model.distribution import Distribution
from lp.registry.model.person import Person
-from lp.registry.model.product import Product
from lp.services.config import config
from lp.services.database import postgresql
from lp.services.database.constants import UTC_NOW
@@ -1001,64 +990,6 @@
transaction.commit()
-class AccessPolicyDistributionAddition(TunableLoop):
- """A `TunableLoop` to add AccessPolicy for all distributions."""
-
- maximum_chunk_size = 5000
-
- def __init__(self, log, abort_time=None):
- super(AccessPolicyDistributionAddition, self).__init__(
- log, abort_time)
- self.transaction = transaction
- self.store = IMasterStore(Distribution)
-
- def findDistributions(self):
- return self.store.find(
- Distribution,
- Not(Exists(
- Select(AccessPolicy.id,
- tables=[AccessPolicy], where=[
- AccessPolicy.distribution_id == Distribution.id]))))
-
- def isDone(self):
- return self.findDistributions().is_empty()
-
- def __call__(self, chunk_size):
- policies = itertools.product(
- self.findDistributions()[:chunk_size],
- (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY))
- getUtility(IAccessPolicySource).create(policies)
- self.transaction.commit()
-
-
-class AccessPolicyProductAddition(TunableLoop):
- """A `TunableLoop` to add AccessPolicy for all products."""
-
- maximum_chunk_size = 5000
-
- def __init__(self, log, abort_time=None):
- super(AccessPolicyProductAddition, self).__init__(log, abort_time)
- self.transaction = transaction
- self.store = IMasterStore(Product)
-
- def findProducts(self):
- return self.store.find(
- Product,
- Not(Exists(
- Select(AccessPolicy.id, tables=[AccessPolicy], where=[
- AccessPolicy.product_id == Product.id]))))
-
- def isDone(self):
- return self.findProducts().is_empty()
-
- def __call__(self, chunk_size):
- policies = itertools.product(
- self.findProducts()[:chunk_size],
- (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY))
- getUtility(IAccessPolicySource).create(policies)
- self.transaction.commit()
-
-
class SpecificationWorkitemMigrator(TunableLoop):
"""Migrate work-items from Specification.whiteboard to
SpecificationWorkItem.
@@ -1433,8 +1364,6 @@
UnusedSessionPruner,
DuplicateSessionPruner,
BugHeatUpdater,
- AccessPolicyDistributionAddition,
- AccessPolicyProductAddition,
BugsInformationTypeMigrator,
]
experimental_tunable_loops = []
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2012-03-14 03:12:52 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2012-03-16 00:48:19 +0000
@@ -55,7 +55,6 @@
from lp.code.model.codeimportevent import CodeImportEvent
from lp.code.model.codeimportresult import CodeImportResult
from lp.registry.enums import InformationType
-from lp.registry.interfaces.accesspolicy import IAccessPolicySource
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.person import IPersonSet
from lp.scripts.garbo import (
@@ -1023,26 +1022,6 @@
self.runHourly()
self.assertNotEqual(old_update, naked_bug.heat_last_updated)
- def test_AccessPolicyDistributionAddition(self):
- switch_dbuser('testadmin')
- distribution = self.factory.makeDistribution()
- transaction.commit()
- self.runHourly()
- ap = getUtility(IAccessPolicySource).findByPillar((distribution,))
- expected = [
- InformationType.USERDATA, InformationType.EMBARGOEDSECURITY]
- self.assertContentEqual(expected, [policy.type for policy in ap])
-
- def test_AccessPolicyProductAddition(self):
- switch_dbuser('testadmin')
- product = self.factory.makeProduct()
- transaction.commit()
- self.runHourly()
- ap = getUtility(IAccessPolicySource).findByPillar((product,))
- expected = [
- InformationType.USERDATA, InformationType.EMBARGOEDSECURITY]
- self.assertContentEqual(expected, [policy.type for policy in ap])
-
def test_SpecificationWorkitemMigrator_not_enabled_by_default(self):
self.assertFalse(getFeatureFlag('garbo.workitem_migrator.enabled'))
switch_dbuser('testadmin')
Follow ups