← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:charm-ppa-publisher-archives-dir into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:charm-ppa-publisher-archives-dir into launchpad:master.

Commit message:
charm: Set archives_dir for PPA publisher

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/450825

The PPA publisher mostly doesn't use this, but it's still used to construct `lp.archivepublisher.config.Config.temproot`, and we need to make sure that that's on the same filesystem as the published archive, otherwise `os.rename` will fail.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-ppa-publisher-archives-dir into launchpad:master.
diff --git a/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py b/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
index e3c5b75..9118203 100644
--- a/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
+++ b/charm/launchpad-ppa-publisher/reactive/launchpad-ppa-publisher.py
@@ -32,6 +32,12 @@ def get_data_dir():
     return os.path.join(base.base_dir(), "data")
 
 
+def archives_dir():
+    # Used by `lp.archivepublisher.config.getPubConfig` to construct
+    # `Config.temproot`, even for PPAs.
+    return os.path.join(get_data_dir(), "archives")
+
+
 def ppa_archive_root():
     return os.path.join(get_data_dir(), "ppa-archive")
 
@@ -53,6 +59,7 @@ def configure():
     ppa_keys_root = os.path.join(data_dir, "ppa-signing-keys")
     oval_data_root = os.path.join(data_dir, "oval-data")
 
+    config["archives_dir"] = archives_dir()
     config["ppa_archive_root"] = ppa_archive_root()
     config["ppa_archive_private_root"] = ppa_archive_private()
     config["ppa_signing_keys_root"] = ppa_keys_root
@@ -60,6 +67,9 @@ def configure():
 
     host.mkdir(data_dir, owner=base.user(), group=base.user(), perms=0o775)
     host.mkdir(
+        archives_dir(), owner=base.user(), group=base.user(), perms=0o775
+    )
+    host.mkdir(
         ppa_archive_root(), owner=base.user(), group=base.user(), perms=0o775
     )
     host.mkdir(
diff --git a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2 b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
index 0a9e514..a0e08e8 100644
--- a/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
+++ b/charm/launchpad-ppa-publisher/templates/launchpad-ppa-publisher-lazr.conf.j2
@@ -12,6 +12,7 @@
 extends: ../launchpad-db-lazr.conf
 
 [archivepublisher]
+archives_dir: {{ archives_dir }}
 {{- opt("oval_data_rsync_endpoint", oval_data_rsync_endpoint) }}
 oval_data_root: {{ base_dir }}/oval-data
 

Follow ups