Merge ~cjwatson/launchpad:garbo-access-artifact-permissions into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 633cc6a9b98eeae483d7a3c50993cf24316e26f7
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:garbo-access-artifact-permissions
Merge into: launchpad:master
Diff against target: 41 lines (+11/-1)
2 files modified
database/schema/security.cfg (+3/-0)
lib/lp/scripts/tests/test_garbo.py (+8/-1)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+401744@code.launchpad.net

Commit message

Grant garbo access to delete AccessArtifact and friends

Description of the change

If a private GitRepository failed to create and is being pruned, then it will have `AccessArtifact` and related rows. This started happening on production recently.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/security.cfg b/database/schema/security.cfg
2index 5da2031..f708f97 100644
3--- a/database/schema/security.cfg
4+++ b/database/schema/security.cfg
5@@ -2414,7 +2414,10 @@ type=user
6
7 [garbo]
8 groups=script,read
9+public.accessartifact = SELECT, DELETE
10+public.accessartifactgrant = SELECT, DELETE
11 public.accesspolicy = SELECT, DELETE
12+public.accesspolicyartifact = SELECT, DELETE
13 public.accesspolicygrant = SELECT, DELETE
14 public.account = SELECT, DELETE
15 public.answercontact = SELECT, DELETE
16diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
17index e7f7dca..ba2b5dd 100644
18--- a/lib/lp/scripts/tests/test_garbo.py
19+++ b/lib/lp/scripts/tests/test_garbo.py
20@@ -1109,6 +1109,13 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
21 repo.status = GitRepositoryStatus.CREATING
22 long_ago += timedelta(seconds=1)
23
24+ # Create an old stale private repository as well.
25+ repo = removeSecurityProxy(self.factory.makeGitRepository(
26+ information_type=InformationType.USERDATA))
27+ repo.date_created = long_ago
28+ repo.status = GitRepositoryStatus.CREATING
29+ long_ago += timedelta(seconds=1)
30+
31 recent_creating, old_available, recent_available = [
32 removeSecurityProxy(self.factory.makeGitRepository())
33 for _ in range(3)]
34@@ -1122,7 +1129,7 @@ class TestGarbo(FakeAdapterMixin, TestCaseWithFactory):
35 recent_available.date_created = recently
36 recent_available.status = GitRepositoryStatus.AVAILABLE
37
38- self.assertEqual(8, store.find(GitRepository).count())
39+ self.assertEqual(9, store.find(GitRepository).count())
40
41 self.runHourly(maximum_chunk_size=2)
42

Subscribers

People subscribed via source and target branches

to status/vote changes: