Merge lp:~laney/ubuntu-cdimage/stop-sync-mirrors into lp:ubuntu-cdimage

Proposed by Iain Lane
Status: Merged
Merged at revision: 1932
Proposed branch: lp:~laney/ubuntu-cdimage/stop-sync-mirrors
Merge into: lp:ubuntu-cdimage
Diff against target: 43 lines (+17/-1)
2 files modified
lib/cdimage/mirror.py (+8/-0)
lib/cdimage/tests/test_mirror.py (+9/-1)
To merge this branch: bzr merge lp:~laney/ubuntu-cdimage/stop-sync-mirrors
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Ɓukasz Zemczak Pending
Review via email: mp+398103@code.launchpad.net

Description of the change

mirror: Add a flag file etc/STOP_SYNC_MIRRORS to stop syncing

Our current method of `chmod -x bin/sync-mirrors` doesn't work. In particular, the mirrors are triggered whenever any daily build is completed. This means that in progress releases are highly vulnerable to leaking early. In the past we have asked Canonical IS to stop rsync to prevent this from happening. But we can take care of it on our side by avoiding ever asking the frontends to pull from us.

A better API where we can ask frontends to only sync *certain* images - thedaily which just finished - would be preferable.

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/cdimage/mirror.py'
2--- lib/cdimage/mirror.py 2015-10-26 11:06:11 +0000
3+++ lib/cdimage/mirror.py 2021-02-16 10:35:39 +0000
4@@ -117,6 +117,14 @@
5
6
7 def trigger_mirrors(config):
8+ paths = [
9+ os.path.join(config.root, "production", "STOP_SYNC_MIRRORS"),
10+ os.path.join(config.root, "etc", "STOP_SYNC_MIRRORS"),
11+ ]
12+ for path in paths:
13+ if os.path.exists(path):
14+ return
15+
16 check_manifest(config)
17
18 key = _get_mirror_key(config)
19
20=== modified file 'lib/cdimage/tests/test_mirror.py'
21--- lib/cdimage/tests/test_mirror.py 2019-02-27 22:57:25 +0000
22+++ lib/cdimage/tests/test_mirror.py 2021-02-16 10:35:39 +0000
23@@ -17,7 +17,7 @@
24
25 """Unit tests for cdimage.mirror."""
26
27-from __future__ import print_function
28+from __future__ import print_function, with_statement
29
30 import os
31
32@@ -224,3 +224,11 @@
33 mock.call(
34 self.config, key, "archvsync", "bar-async", background=True),
35 ])
36+
37+ @mock.patch("cdimage.mirror._trigger_mirror")
38+ def test_no_trigger_mirrors_when_stopped(self, mock_trigger_mirror):
39+ self.configure_triggers()
40+ os.mkdir(os.path.join(self.config.root, "etc"))
41+ with open(os.path.join(self.config.root, "etc", "STOP_SYNC_MIRRORS"), "w"):
42+ trigger_mirrors(self.config)
43+ mock_trigger_mirror.assert_not_called()

Subscribers

People subscribed via source and target branches