Merge lp:~deryck/launchpad/remove-product-info-typo-garbo into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Merged at revision: 16369
Proposed branch: lp:~deryck/launchpad/remove-product-info-typo-garbo
Merge into: lp:launchpad
Diff against target: 66 lines (+0/-45)
2 files modified
lib/lp/scripts/garbo.py (+0/-27)
lib/lp/scripts/tests/test_garbo.py (+0/-18)
To merge this branch: bzr merge lp:~deryck/launchpad/remove-product-info-typo-garbo
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+137210@code.launchpad.net

Commit message

Remove the garbo job and related test to populate default values for Product.information_type, which is no longer needed due to model and db schema changes.

Description of the change

This branch is really just a bit of clean up. We no longer need the garbo job to populate default values for Product.information_type. This branch removes that job and its related test.

We should be safe to remove this now, since model code adds a default for us. But just to be cautious, I won't land this until my recent db patches are deployed.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

I think you also need to remove ProductInformationTypeDefault from DailyDatabaseGarbageCollector.tunable_loops, at the bottom of lib/lp/scripts/garbo.py

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/scripts/garbo.py'
2--- lib/lp/scripts/garbo.py 2012-11-26 08:33:03 +0000
3+++ lib/lp/scripts/garbo.py 2012-11-30 14:31:56 +0000
4@@ -1187,33 +1187,6 @@
5 self._update_oldest()
6
7
8-class ProductInformationTypeDefault(TunableLoop):
9- """Set all Product.information_type to Public."""
10-
11- maximum_chunk_size = 1000
12-
13- def __init__(self, log, abort_time=None):
14- super(ProductInformationTypeDefault, self).__init__(
15- log, abort_time)
16- self.rows_updated = None
17- self.store = IMasterStore(Product)
18-
19- def isDone(self):
20- """See `TunableLoop`."""
21- return self.rows_updated == 0
22-
23- def __call__(self, chunk_size):
24- """See `TunableLoop`."""
25- subselect = Select(
26- Product.id, Product._information_type == None,
27- limit=chunk_size)
28- result = self.store.execute(
29- Update({Product._information_type: 1},
30- Product.id.is_in(subselect)))
31- transaction.commit()
32- self.rows_updated = result.rowcount
33-
34-
35 class SuggestiveTemplatesCacheUpdater(TunableLoop):
36 """Refresh the SuggestivePOTemplate cache.
37
38
39=== modified file 'lib/lp/scripts/tests/test_garbo.py'
40--- lib/lp/scripts/tests/test_garbo.py 2012-11-26 08:33:03 +0000
41+++ lib/lp/scripts/tests/test_garbo.py 2012-11-30 14:31:56 +0000
42@@ -1148,24 +1148,6 @@
43 [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],
44 self.getAccessPolicyTypes(product))
45
46- def test_ProductInformationTypeDefault(self):
47- switch_dbuser('testadmin')
48- # Set all existing projects to something other than None or 1.
49- store = IMasterStore(Product)
50- store.execute(Update(
51- {Product._information_type: 2}))
52- store.flush()
53- # Make a new product without an information_type.
54- product = self.factory.makeProduct()
55- store.execute(Update(
56- {Product._information_type: None}, Product.id == product.id))
57- store.flush()
58- self.assertEqual(1, store.find(Product,
59- Product._information_type == None).count())
60- self.runDaily()
61- self.assertEqual(0, store.find(Product,
62- Product._information_type == None).count())
63-
64 def test_PopulateLatestPersonSourcePackageReleaseCache(self):
65 switch_dbuser('testadmin')
66 # Make some same test data - we create published source package