Merge lp:~jtv/launchpad/db-bug-752181 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: 10409
Proposed branch: lp:~jtv/launchpad/db-bug-752181
Merge into: lp:launchpad/db-devel
Diff against target: 67 lines (+12/-6)
4 files modified
cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices (+3/-2)
cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt (+3/-0)
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+2/-1)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+4/-3)
To merge this branch: bzr merge lp:~jtv/launchpad/db-bug-752181
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+56903@code.launchpad.net

Commit message

[r=adeuring][bug=752181] Pass OVERRIDEROOT to publish-distro plugins.

Description of the change

= Summary =

In replacing the system-specific and distro-specific parts of the cron.publish-ftpmaster script with run-parts plugins, I forgot to pass a parameter from the archives' publisher config to the publish-distro plugins: OVERRIDEROOT. It was hard-coded in the old script.

== Proposed fix ==

Take OVERRIDEROOT from the archive-configuration model object (it's actually a separate thing from lazr config) and passes it to the script.

== Pre-implementation notes ==

William notes that the indices directory may not exist yet. So I changed the plugin script to create it if necessary.

== Implementation details ==

I was careless in my unit-testing of the new python-based publish-ftpmaster script. The two tests for parameters being passed to the plugin scripts would fail if I passed too many, but not if I passed too few (which is what really needs testing). Proper TDD would have shown me this as I ran the test before implementing the feature. That wasn't really feasible for such a large and radical branch though; in retrospect it might have been possible to break it down into smaller branches somehow.

== Tests ==

{{{
./bin/test lp.archivepublisher.tests.test_publish_ftpmaster -t passes_parameters
}}}

== Demo and Q/A ==

We run publish-ftpmaster on dogfood and watch for error output or missing results.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices
  cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt
  lib/lp/archivepublisher/scripts/publish_ftpmaster.py
  lib/lp/archivepublisher/tests/test_publish_ftpmaster.py

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
=== modified file 'cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices'
--- cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices 2011-03-28 09:18:42 +0000
+++ cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/30-copy-indices 2011-04-08 09:29:08 +0000
@@ -2,7 +2,8 @@
22
3echo "$(date -R): Copying the indices into place."3echo "$(date -R): Copying the indices into place."
44
5INDICES="$ARCHIVEROOT/indices"5INDICES=$ARCHIVEROOT/indices
66
7mkdir -p -- $INDICES
7rm -f -- "$INDICES/override"8rm -f -- "$INDICES/override"
8cp -- "$OVERRIDEROOT"/override.* "$INDICES/"9cp -- $OVERRIDEROOT/override.* $INDICES/
910
=== modified file 'cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt'
--- cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt 2011-03-31 08:38:55 +0000
+++ cronscripts/publishing/distro-parts/ubuntu/publish-distro.d/README.txt 2011-04-08 09:29:08 +0000
@@ -18,5 +18,8 @@
18DISTSROOT - the archive's dists root directory18DISTSROOT - the archive's dists root directory
19(e.g. /srv/launchpad.net/ubuntu-archive/ubuntu/dists )19(e.g. /srv/launchpad.net/ubuntu-archive/ubuntu/dists )
2020
21OVERRIDEROOT - the archive's overrides root directory
22(e.g. /srv/launchpad.net/ubuntu-overrides )
23
21The script's PATH will be extended with the Launchpad source tree's24The script's PATH will be extended with the Launchpad source tree's
22cronscripts/publishing directory.25cronscripts/publishing directory.
2326
=== modified file 'lib/lp/archivepublisher/scripts/publish_ftpmaster.py'
--- lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2011-04-01 07:12:44 +0000
+++ lib/lp/archivepublisher/scripts/publish_ftpmaster.py 2011-04-08 09:29:08 +0000
@@ -256,8 +256,9 @@
256 """Execute the publish-distro hooks."""256 """Execute the publish-distro hooks."""
257 archive_config = self.configs[archive.purpose]257 archive_config = self.configs[archive.purpose]
258 env = {258 env = {
259 'ARCHIVEROOT': archive_config.archiveroot,
259 'DISTSROOT': archive_config.distsroot,260 'DISTSROOT': archive_config.distsroot,
260 'ARCHIVEROOT': archive_config.archiveroot,261 'OVERRIDEROOT': archive_config.overrideroot,
261 }262 }
262 self.runParts('publish-distro.d', env)263 self.runParts('publish-distro.d', env)
263264
264265
=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2011-03-31 11:25:53 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2011-04-08 09:29:08 +0000
@@ -479,8 +479,9 @@
479 script.runPublishDistroParts(distro.main_archive)479 script.runPublishDistroParts(distro.main_archive)
480 args, kwargs = script.runParts.calls[0]480 args, kwargs = script.runParts.calls[0]
481 parts_dir, env = args481 parts_dir, env = args
482 required_parameters = set(["DISTSROOT", "ARCHIVEROOT"])482 required_parameters = set([
483 missing_parameters = set(env.keys()).difference(required_parameters)483 "ARCHIVEROOT", "DISTSROOT", "OVERRIDEROOT"])
484 missing_parameters = required_parameters.difference(set(env.keys()))
484 self.assertEqual(set(), missing_parameters)485 self.assertEqual(set(), missing_parameters)
485486
486 def test_installDists_sets_done_pub(self):487 def test_installDists_sets_done_pub(self):
@@ -642,7 +643,7 @@
642 args, kwargs = script.runParts.calls[0]643 args, kwargs = script.runParts.calls[0]
643 parts_dir, env = args644 parts_dir, env = args
644 required_parameters = set(["ARCHIVEROOTS", "SECURITY_UPLOAD_ONLY"])645 required_parameters = set(["ARCHIVEROOTS", "SECURITY_UPLOAD_ONLY"])
645 missing_parameters = set(env.keys()).difference(required_parameters)646 missing_parameters = required_parameters.difference(set(env.keys()))
646 self.assertEqual(set(), missing_parameters)647 self.assertEqual(set(), missing_parameters)
647648
648 def test_publishSecurityUploads_skips_pub_if_no_security_updates(self):649 def test_publishSecurityUploads_skips_pub_if_no_security_updates(self):

Subscribers

People subscribed via source and target branches

to status/vote changes: