Merge ~cjwatson/launchpad:charm-ftpmaster-uploader-queue-permissions into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 85f806dee48cb8ad6a041043bf021aebfc803614
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:charm-ftpmaster-uploader-queue-permissions
Merge into: launchpad:master
Diff against target: 47 lines (+15/-13)
1 file modified
charm/launchpad-ftpmaster-uploader/reactive/launchpad-ftpmaster-uploader.py (+15/-13)
Reviewer Review Type Date Requested Status
Simone Pelosi Approve
Review via email: mp+450807@code.launchpad.net

Commit message

charm: Fix queue permissions in ftpmaster-uploader

Description of the change

This syncs this charm up a bit more closely with `launchpad-ppa-uploader`. Previously, the queue directories were all owned by `root:root` so neither `txpkgupload` nor `process-queue` could do anything in them; in addition, the `launchpad` user needs to be a member of the `txpkgupload` group so that it can see uploaded files.

To post a comment you must log in.
Revision history for this message
Simone Pelosi (pelpsi) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/launchpad-ftpmaster-uploader/reactive/launchpad-ftpmaster-uploader.py b/charm/launchpad-ftpmaster-uploader/reactive/launchpad-ftpmaster-uploader.py
2index 7966a95..d29f96f 100644
3--- a/charm/launchpad-ftpmaster-uploader/reactive/launchpad-ftpmaster-uploader.py
4+++ b/charm/launchpad-ftpmaster-uploader/reactive/launchpad-ftpmaster-uploader.py
5@@ -36,18 +36,20 @@ def configure_logrotate(config):
6 def configure():
7 hookenv.log("Configuring ftpmaster uploader")
8 config = get_service_config()
9- config["ubuntu_queue_dir"] = os.path.join(base.base_dir(), "ubuntu-queue")
10- host.mkdir(config["ubuntu_queue_dir"], perms=0o755)
11- host.mkdir(
12- os.path.join(config["ubuntu_queue_dir"], "incoming"), perms=0o755
13- )
14- host.mkdir(
15- os.path.join(config["ubuntu_queue_dir"], "accepted"), perms=0o755
16- )
17+
18+ # Create queue directories.
19+ ubuntu_queue_dir = os.path.join(base.base_dir(), "ubuntu-queue")
20 host.mkdir(
21- os.path.join(config["ubuntu_queue_dir"], "rejected"), perms=0o755
22+ ubuntu_queue_dir, owner=base.user(), group=base.user(), perms=0o755
23 )
24- host.mkdir(os.path.join(config["ubuntu_queue_dir"], "failed"), perms=0o755)
25+ config["ubuntu_queue_dir"] = ubuntu_queue_dir
26+ for queue in ("accepted", "failed", "rejected"):
27+ host.mkdir(
28+ os.path.join(ubuntu_queue_dir, queue),
29+ owner=base.user(),
30+ group=base.user(),
31+ perms=0o755,
32+ )
33
34 configure_lazr(
35 config,
36@@ -64,10 +66,10 @@ def configure():
37 @when_not("service.txpkgupload-configured")
38 def configure_txpkgupload():
39 fsroot = os.path.join(base.base_dir(), "ubuntu-queue", "incoming")
40+ host.mkdir(fsroot, owner=base.user(), group="txpkgupload", perms=0o775)
41 txpkgupload = endpoint_from_flag("upload-queue-processor.available")
42- txpkgupload.set_config(
43- fsroot=fsroot,
44- )
45+ txpkgupload.set_config(fsroot=fsroot)
46+ host.add_user_to_group(base.user(), "txpkgupload")
47 set_flag("service.txpkgupload-configured")
48
49

Subscribers

People subscribed via source and target branches

to status/vote changes: