launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01880
[Merge] lp:~jelmer/launchpad/syncpackagejob-cronjob into lp:launchpad/devel
Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/syncpackagejob-cronjob into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This adds a cron job for syncing packages.
--
https://code.launchpad.net/~jelmer/launchpad/syncpackagejob-cronjob/+merge/40425
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/syncpackagejob-cronjob into lp:launchpad/devel.
=== modified file 'configs/development/launchpad-lazr.conf'
--- configs/development/launchpad-lazr.conf 2010-10-25 20:42:59 +0000
+++ configs/development/launchpad-lazr.conf 2010-11-09 13:06:54 +0000
@@ -137,6 +137,10 @@
oops_prefix: IDSJ
error_dir: /var/tmp/soyuz.test
+[sync_packages]
+oops_prefix: IDSJ
+error_dir: /var/tmp/soyuz.test
+
[launchpad]
enable_test_openid_provider: True
openid_provider_vhost: testopenid
=== added file 'cronscripts/sync_packages.py'
--- cronscripts/sync_packages.py 1970-01-01 00:00:00 +0000
+++ cronscripts/sync_packages.py 2010-11-09 13:06:54 +0000
@@ -0,0 +1,27 @@
+#!/usr/bin/python -S
+#
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Synchronise packages.."""
+
+__metaclass__ = type
+
+import _pythonpath
+
+from lp.services.job.runner import JobCronScript
+from lp.soyuz.interfaces.distributionjob import (
+ ISyncPackageJobSource,
+ )
+
+
+class RunSyncPackageJob(JobCronScript):
+ """Run SyncPackageJob jobs."""
+
+ config_name = 'sync_packages'
+ source_interface = ISyncPackageJobSource
+
+
+if __name__ == '__main__':
+ script = RunSyncPackageJob()
+ script.lock_and_run()
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-10-25 20:34:14 +0000
+++ database/schema/security.cfg 2010-11-09 13:06:54 +0000
@@ -968,6 +968,14 @@
public.sourcepackagepublishinghistory = SELECT, INSERT
public.sourcepackagerelease = SELECT
+[sync_packages]
+type=user
+groups=script
+public.distribution = SELECT
+public.distributionjob = SELECT
+public.distroseries = SELECT, UPDATE
+public.job = SELECT, UPDATE
+
[write]
type=group
# Full access except for tables that are exclusively updated by
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf 2010-11-08 05:22:26 +0000
+++ lib/canonical/config/schema-lazr.conf 2010-11-09 13:06:54 +0000
@@ -940,6 +940,20 @@
# See [error_reports].
copy_to_zlog: false
+[sync_packages]
+dbuser: sync_packages
+
+# See [error_reports].
+error_dir: none
+
+# See [error_reports].
+oops_prefix: none
+
+# See [error_reports].
+copy_to_zlog: false
+
+
+
[karmacacheupdater]
# The database user which will be used by this process.
# datatype: string
=== modified file 'lib/lp/soyuz/tests/test_syncpackagejob.py'
--- lib/lp/soyuz/tests/test_syncpackagejob.py 2010-11-04 13:37:23 +0000
+++ lib/lp/soyuz/tests/test_syncpackagejob.py 2010-11-09 13:06:54 +0000
@@ -1,9 +1,17 @@
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+"""Tests for sync package jobs."""
+
+import os
+import subprocess
+import sys
+
from zope.component import getUtility
+from canonical.config import config
from canonical.testing import LaunchpadZopelessLayer
+
from lp.soyuz.interfaces.distributionjob import (
ISyncPackageJob,
ISyncPackageJobSource,
@@ -45,3 +53,12 @@
PackagePublishingPocket.RELEASE,
"foo", "1.0-1", include_binaries=False)
self.assertContentEqual([job], source.getActiveJobs(archive2))
+
+ def test_cronscript(self):
+ script = os.path.join(
+ config.root, 'cronscripts', 'sync_packages.py')
+ args = [sys.executable, script, '-v']
+ process = subprocess.Popen(
+ args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = process.communicate()
+ self.assertEqual(process.returncode, 0)