Merge lp:~jtv/launchpad/bug-645925 into lp:launchpad/db-devel

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 9826
Proposed branch: lp:~jtv/launchpad/bug-645925
Merge into: lp:launchpad/db-devel
Diff against target: 85 lines (+22/-4)
2 files modified
database/schema/security.cfg (+3/-2)
lib/lp/translations/tests/test_translationtemplatesbuild.py (+19/-2)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-645925
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+36540@code.launchpad.net

Commit message

Missing db privileges for TranslationTemplatesBuild

Description of the change

= Bug 645925 =

We're making the transition to a new data model for the build farm. We just landed a new class, TranslationTemplatesBuild that was one of the big missing tracts of this transition.

Instantiating this class in the branch scanner went wrong, however, because of missing database privileges. This branch should fix that.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/security.cfg'
2--- database/schema/security.cfg 2010-09-23 11:37:58 +0000
3+++ database/schema/security.cfg 2010-09-24 10:39:53 +0000
4@@ -276,7 +276,7 @@
5 public.translationgroup = SELECT, INSERT, UPDATE
6 public.translationimportqueueentry = SELECT, INSERT, UPDATE, DELETE
7 public.translationmessage = SELECT, INSERT, UPDATE
8-public.translationtemplatesbuild = SELECT, INSERT, DELETE
9+public.translationtemplatesbuild = SELECT, INSERT, UPDATE, DELETE
10 public.translator = SELECT, INSERT, UPDATE, DELETE
11 public.usertouseremail = SELECT, UPDATE
12 public.validpersoncache = SELECT
13@@ -597,6 +597,7 @@
14 public.distributionsourcepackage = SELECT, UPDATE
15 public.emailaddress = SELECT
16 public.job = SELECT, INSERT, UPDATE, DELETE
17+public.translationtemplatesbuild = SELECT, INSERT
18 # Karma
19 public.karma = SELECT, INSERT
20 public.karmaaction = SELECT
21@@ -890,6 +891,7 @@
22 public.flatpackagesetinclusion = SELECT
23 public.teamparticipation = SELECT
24 public.translationimportqueueentry = SELECT, INSERT, UPDATE
25+public.translationtemplatesbuild = SELECT, INSERT
26
27 [ppa-apache-log-parser]
28 type=user
29@@ -1441,7 +1443,6 @@
30 [translationsbranchscanner]
31 type=user
32 groups=branchscanner,translations_approval
33-public.translationtemplatesbuild = SELECT, INSERT
34
35 [translationstobranch]
36 type=user
37
38=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuild.py'
39--- lib/lp/translations/tests/test_translationtemplatesbuild.py 2010-09-10 11:27:48 +0000
40+++ lib/lp/translations/tests/test_translationtemplatesbuild.py 2010-09-24 10:39:53 +0000
41@@ -5,10 +5,13 @@
42
43 __metaclass__ = type
44
45+from storm.store import Store
46+import transaction
47 from zope.component import getUtility
48 from zope.interface.verify import verifyObject
49
50-from canonical.testing import DatabaseFunctionalLayer
51+from canonical.config import config
52+from canonical.testing import LaunchpadZopelessLayer
53 from lp.buildmaster.enums import BuildFarmJobType
54 from lp.buildmaster.interfaces.buildfarmjob import (
55 IBuildFarmJob,
56@@ -29,7 +32,7 @@
57
58 class TestTranslationTemplatesBuild(TestCaseWithFactory):
59
60- layer = DatabaseFunctionalLayer
61+ layer = LaunchpadZopelessLayer
62
63 def _makeBuildFarmJob(self):
64 """Create a `BuildFarmJob` for testing."""
65@@ -48,6 +51,20 @@
66 self.assertEqual(build_farm_job, build.build_farm_job)
67 self.assertEqual(branch, build.branch)
68
69+ def test_permissions(self):
70+ # The branch scanner creates TranslationTemplatesBuilds. It has
71+ # the database privileges it needs for that.
72+ branch = self.factory.makeBranch()
73+ transaction.commit()
74+ self.layer.switchDbUser(config.branchscanner.dbuser)
75+ utility = getUtility(ITranslationTemplatesBuildSource)
76+ build_farm_job = self._makeBuildFarmJob()
77+ specific_job = utility.create(build_farm_job, branch)
78+
79+ # Writing the new objects to the database violates no access
80+ # restrictions.
81+ Store.of(build_farm_job).flush()
82+
83 def test_created_by_buildjobsource(self):
84 # ITranslationTemplatesBuildJobSource.create also creates a
85 # TranslationTemplatesBuild. This utility will become obsolete

Subscribers

People subscribed via source and target branches

to status/vote changes: