Merge lp:~hloeung/ubuntu-repository-cache/fix-initial-sync-perms into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Paul Collins
Approved revision: 277
Merged at revision: 277
Proposed branch: lp:~hloeung/ubuntu-repository-cache/fix-initial-sync-perms
Merge into: lp:ubuntu-repository-cache
Diff against target: 39 lines (+5/-3)
1 file modified
lib/ubuntu_repository_cache/metadata_sync.py (+5/-3)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/fix-initial-sync-perms
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Canonical IS Reviewers Pending
Review via email: mp+387097@code.launchpad.net

Commit message

Fix permissions for initial metadata sync - LP:1680860

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 277

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/ubuntu_repository_cache/metadata_sync.py'
2--- lib/ubuntu_repository_cache/metadata_sync.py 2020-05-14 04:09:24 +0000
3+++ lib/ubuntu_repository_cache/metadata_sync.py 2020-07-09 05:07:42 +0000
4@@ -71,7 +71,7 @@
5 # around subprocess - ~tribaal
6
7 def rsync(from_path, to_path, options, log, flags="-r",
8- check_output=check_output, timeout=None):
9+ check_output=check_output, user=None, timeout=None):
10 """
11 A wrapper around subprocess to execute an rsync between a source and a
12 destination.
13@@ -87,6 +87,8 @@
14 cmd = ["/usr/bin/rsync", flags]
15 if timeout:
16 cmd = ["/usr/bin/timeout", str(timeout)] + cmd
17+ if user:
18+ cmd = ["sudo", "-u", user] + cmd
19 cmd.extend(options)
20 cmd.append(from_path)
21 cmd.append(to_path)
22@@ -395,7 +397,7 @@
23 # exclude everything else under dists as the last rule.
24 rsync_options += ('--exclude=dists/*',)
25
26- rsync(rsync_source, dest, rsync_options, log, timeout=3600)
27+ rsync(rsync_source, dest, rsync_options, log, user='www-sync', timeout=3600)
28
29
30 @backoff.on_exception(backoff.expo, CalledProcessError,
31@@ -419,7 +421,7 @@
32 # Sync just the root directory
33 rsync_options = ('--links', '--perms', '--times', '--dirs', '--chmod=g+w',
34 '--delete', '--compress', '--link-dest=%s/' % link_dest)
35- rsync(source, dest, rsync_options, log, flags='--quiet', timeout=3600)
36+ rsync(source, dest, rsync_options, log, flags='--quiet', user='www-sync', timeout=3600)
37
38 # Check for file 'Archive-Update-in-Progress*' which signals
39 # the need to sleep or try another IP

Subscribers

People subscribed via source and target branches