launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18645
[Merge] lp:~cjwatson/launchpad/fix-reclaim-git-job into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/fix-reclaim-git-job into lp:launchpad.
Commit message:
Fix a couple of problems running ReclaimGitRepositorySpaceJob in a real celery environment.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/fix-reclaim-git-job/+merge/260158
Fix a couple of problems running ReclaimGitRepositorySpaceJob in a real celery environment.
getOopsVars wasn't quite usable in a job where repository is None, and the DB user I'd chosen is only usable from Bazaar codehosting systems.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/fix-reclaim-git-job into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2015-05-19 11:29:24 +0000
+++ database/schema/security.cfg 2015-05-26 13:39:54 +0000
@@ -2039,7 +2039,6 @@
[reclaim-branch-space]
groups=script
public.branchjob = SELECT
-public.gitjob = SELECT
public.job = SELECT, UPDATE
type=user
=== modified file 'lib/lp/code/model/gitjob.py'
--- lib/lp/code/model/gitjob.py 2015-05-19 11:29:24 +0000
+++ lib/lp/code/model/gitjob.py 2015-05-26 13:39:54 +0000
@@ -162,8 +162,9 @@
oops_vars.extend([
('git_job_id', self.context.job.id),
('git_job_type', self.context.job_type.title),
- ('git_repository_id', self.context.repository.id),
- ('git_repository_name', self.context.repository.unique_name)])
+ ('git_repository_name', self.metadata["repository_name"])])
+ if self.context.repository is not None:
+ oops_vars.append(('git_repository_id', self.context.repository.id))
return oops_vars
def getErrorRecipients(self):
=== modified file 'lib/lp/code/model/tests/test_gitjob.py'
--- lib/lp/code/model/tests/test_gitjob.py 2015-05-19 11:29:24 +0000
+++ lib/lp/code/model/tests/test_gitjob.py 2015-05-26 13:39:54 +0000
@@ -32,6 +32,7 @@
ReclaimGitRepositorySpaceJob,
)
from lp.services.database.constants import UTC_NOW
+from lp.services.job.runner import JobRunner
from lp.testing import (
TestCaseWithFactory,
time_counter,
@@ -139,7 +140,7 @@
job._hosting_client.getCommits = FakeMethod(
result=self.makeFakeCommits(author, author_date_gen, paths))
with dbuser("branchscanner"):
- job.run()
+ JobRunner([job]).runAll()
self.assertRefsMatch(repository.refs, repository, paths)
def test_logs_bad_ref_info(self):
@@ -153,7 +154,7 @@
'ref info does not contain "object" key')
with self.expectedLog(expected_message):
with dbuser("branchscanner"):
- job.run()
+ JobRunner([job]).runAll()
self.assertEqual([], list(repository.refs))
@@ -210,9 +211,9 @@
job = ReclaimGitRepositorySpaceJob.create(name, path)
self.makeJobReady(job)
[job] = list(ReclaimGitRepositorySpaceJob.iterReady())
- with dbuser("reclaim-branch-space"):
+ with dbuser("branchscanner"):
job._hosting_client.delete = FakeMethod()
- job.run()
+ JobRunner([job]).runAll()
self.assertEqual([(path,)], job._hosting_client.delete.extract_args())
=== modified file 'lib/lp/services/config/schema-lazr.conf'
--- lib/lp/services/config/schema-lazr.conf 2015-05-19 11:29:24 +0000
+++ lib/lp/services/config/schema-lazr.conf 2015-05-26 13:39:54 +0000
@@ -1820,7 +1820,7 @@
[IReclaimGitRepositorySpaceJobSource]
module: lp.code.interfaces.gitjob
-dbuser: reclaim-branch-space
+dbuser: branchscanner
[IRemoveArtifactSubscriptionsJobSource]
module: lp.registry.interfaces.sharingjob
Follow ups