launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06222
[Merge] lp:~stub/launchpad/trivial into lp:launchpad
Stuart Bishop has proposed merging lp:~stub/launchpad/trivial into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #357623 in Launchpad itself: "answertracker db user should be renamed expire_questions"
https://bugs.launchpad.net/launchpad/+bug/357623
Bug #732510 in Launchpad itself: "poppy-sftp should connect to the database with a unique user ID"
https://bugs.launchpad.net/launchpad/+bug/732510
Bug #770297 in Launchpad itself: "The sync_packages database user should be renamed to copy_packages."
https://bugs.launchpad.net/launchpad/+bug/770297
Bug #902063 in Launchpad itself: "LoopTuner loses exceptions if cleanUp fails"
https://bugs.launchpad.net/launchpad/+bug/902063
For more details, see:
https://code.launchpad.net/~stub/launchpad/trivial/+merge/91106
= Summary =
Make more stuff connect as unique database users.
== Proposed fix ==
== Pre-implementation notes ==
== Implementation details ==
== Tests ==
== Demo and Q/A ==
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/services/config/schema-lazr.conf
cronscripts/expire-questions.py
lib/devscripts/ec2test/account.py
database/schema/security.cfg
lib/lp/soyuz/tests/test_packagecopyjob.py
lib/lp/poppy/tests/test_poppy.py
lib/lp/services/config/__init__.py
daemons/poppy-sftp.tac
./lib/lp/services/config/schema-lazr.conf
505: Line exceeds 80 characters.
1120: Line exceeds 80 characters.
1127: Line exceeds 80 characters.
1723: Line exceeds 80 characters.
./cronscripts/expire-questions.py
20: '_pythonpath' imported but unused
--
https://code.launchpad.net/~stub/launchpad/trivial/+merge/91106
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/trivial into lp:launchpad.
=== modified file 'cronscripts/expire-questions.py'
--- cronscripts/expire-questions.py 2012-01-01 03:14:54 +0000
+++ cronscripts/expire-questions.py 2012-02-01 15:12:42 +0000
@@ -20,7 +20,6 @@
import _pythonpath
from lp.answers.scripts.questionexpiration import QuestionJanitor
-from lp.services.config import config
from lp.services.scripts.base import LaunchpadCronScript
@@ -32,8 +31,7 @@
configured through config.answertracker.days_before_expiration.
"""
usage = "usage: %prog [options]"
- description = __doc__
-
+ description = __doc__
def main(self):
"""Expire old questions."""
@@ -42,7 +40,6 @@
if __name__ == '__main__':
- script = ExpireQuestions('expire-questions',
- dbuser=config.answertracker.dbuser)
+ script = ExpireQuestions(
+ 'expire-questions', dbuser='expire_questions')
script.lock_and_run()
-
=== modified file 'daemons/poppy-sftp.tac'
--- daemons/poppy-sftp.tac 2011-12-29 05:29:36 +0000
+++ daemons/poppy-sftp.tac 2012-02-01 15:12:42 +0000
@@ -18,7 +18,10 @@
from zope.interface import implements
-from lp.services.config import config
+from lp.services.config import (
+ config,
+ dbconfig,
+ )
from lp.services.daemons import readyservice
from lp.services.scripts import execute_zcml_for_scripts
@@ -35,6 +38,10 @@
from lp.services.twistedsupport.loggingsupport import set_up_oops_reporting
+# Use a unique db user per policy and Bug #732510.
+dbconfig.override(dbuser='poppy_sftp')
+
+
def make_portal():
"""Create and return a `Portal` for the SSH service.
@@ -99,6 +106,7 @@
ftpservice.setServiceParent(application)
+
def timeout_decorator(factory):
"""Add idle timeouts to a factory."""
return TimeoutFactory(factory, timeoutPeriod=config.poppy.idle_timeout)
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2012-01-25 14:16:02 +0000
+++ database/schema/security.cfg 2012-02-01 15:12:42 +0000
@@ -953,6 +953,12 @@
type=user
groups=fiera
+[poppy_sftp]
+# This really should be inheriting from something more specific to the
+# soyuz realm.
+groups=launchpad_main
+type=user
+
[ppa-apache-log-parser]
groups=script
public.archive = SELECT
@@ -1016,8 +1022,8 @@
public.sourcepackagereleasefile = SELECT
type=user
-[sync_packages]
-# sync_packages does a lot of the same work that process-accepted.py (queued)
+[copy_packages]
+# copy_packages does a lot of the same work that process-accepted.py (queued)
# does, so it's easier to inherit its permissions than try and work them all
# out from scratch again.
groups=script,queued
@@ -1233,6 +1239,10 @@
public.validpersonorteamcache = SELECT
type=user
+[expire_questions]
+groups=script,answertracker
+type=user
+
[uploader]
groups=script,uploading
type=user
=== modified file 'lib/devscripts/ec2test/account.py'
--- lib/devscripts/ec2test/account.py 2012-01-01 03:03:28 +0000
+++ lib/devscripts/ec2test/account.py 2012-02-01 15:12:42 +0000
@@ -38,6 +38,7 @@
'259696152397': 'bac',
'873925794399': 'wgrant',
'957911449157': 'mbp',
+ '340983519589': 'stub',
# ...anyone else want in on the fun?
}
=== modified file 'lib/lp/poppy/tests/test_poppy.py'
--- lib/lp/poppy/tests/test_poppy.py 2012-01-26 15:34:02 +0000
+++ lib/lp/poppy/tests/test_poppy.py 2012-02-01 15:12:42 +0000
@@ -32,6 +32,7 @@
from lp.services.config import config
from lp.services.daemons.tachandler import TacTestSetup
from lp.testing import TestCaseWithFactory
+from lp.testing.dbuser import switch_dbuser
from lp.testing.keyserver import KeyServerTac
from lp.testing.layers import (
ZopelessAppServerLayer,
@@ -193,6 +194,7 @@
"""Set up poppy in a temp dir."""
super(TestPoppy, self).setUp()
self.root_dir = self.makeTemporaryDirectory()
+ switch_dbuser('poppy_sftp')
self.server = self.server_factory(self.root_dir, self.factory)
self.useFixture(self.server)
=== modified file 'lib/lp/services/config/__init__.py'
--- lib/lp/services/config/__init__.py 2012-01-06 11:08:30 +0000
+++ lib/lp/services/config/__init__.py 2012-02-01 15:12:42 +0000
@@ -6,8 +6,6 @@
The configuration section used is specified using the LPCONFIG
environment variable, and defaults to 'development'
-
-XXX: Robert Collins 2010-10-20 bug=663454 this is in the wrong namespace.
'''
__metaclass__ = type
=== modified file 'lib/lp/services/config/schema-lazr.conf'
--- lib/lp/services/config/schema-lazr.conf 2012-01-31 01:22:32 +0000
+++ lib/lp/services/config/schema-lazr.conf 2012-02-01 15:12:42 +0000
@@ -1953,9 +1953,7 @@
[IPlainPackageCopyJobSource]
# This section is used by cronscripts/process-job-source.py.
module: lp.soyuz.interfaces.packagecopyjob
-# XXX: GavinPanella 2011-04-20 bug=770297: The sync_packages database
-# user should be renamed to copy_packages.
-dbuser: sync_packages
+dbuser: copy_packages
crontab_group: FREQUENT
# See [error_reports].
=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py 2012-01-20 15:42:44 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py 2012-02-01 15:12:42 +0000
@@ -1108,7 +1108,7 @@
component = self.factory.makeComponent()
section = self.factory.makeSection()
pcj = self.factory.makePlainPackageCopyJob()
- switch_dbuser('sync_packages')
+ switch_dbuser('copy_packages')
override = SourceOverride(
source_package_name=name,
@@ -1167,7 +1167,7 @@
section = self.factory.makeSection()
pcj = self.factory.makePlainPackageCopyJob(
package_name=name.name, package_version="1.0")
- switch_dbuser('sync_packages')
+ switch_dbuser('copy_packages')
override = SourceOverride(
source_package_name=name,