← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/lp-archive:pass-pockets-to-non-timestamp-esm-layouts into lp-archive:main

 

Guruprasad has proposed merging ~lgp171188/lp-archive:pass-pockets-to-non-timestamp-esm-layouts into lp-archive:main.

Commit message:
Pass the pockets config value to non-timestamp ESM layouts

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/lp-archive/+git/lp-archive/+merge/468838
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/lp-archive:pass-pockets-to-non-timestamp-esm-layouts into lp-archive:main.
diff --git a/lp_archive/archive.py b/lp_archive/archive.py
index 5a8f953..0941ffb 100644
--- a/lp_archive/archive.py
+++ b/lp_archive/archive.py
@@ -271,6 +271,7 @@ def init_app(app: Flask) -> None:
             defaults={
                 "archive": layout["archive"],
                 "resource": layout["purpose"],
+                "pockets": layout.get("pockets"),
             },
         )
     app.after_request(add_headers)
diff --git a/tests/test_archive.py b/tests/test_archive.py
index ffd44e1..66bc498 100644
--- a/tests/test_archive.py
+++ b/tests/test_archive.py
@@ -670,3 +670,19 @@ def test_translate_esm_non_release_pocket_path(client, archive_proxy, caplog):
             datetime(2024, 6, 1, 0, 0, 0, tzinfo=timezone.utc),
         ),
     ]
+
+    archive_proxy.call_log = []
+    response = client.get(
+        "/infra/ubuntu/dists/focal-infra-updates/InRelease",
+        headers=[("Host", "snapshot.esm-infra-updates.test")],
+    )
+    assert response.status_code == 307
+    assert response.location == "http://librarian.example.org/1";
+    assert archive_proxy.call_log == [
+        (
+            "translatePath",
+            "~user/ubuntu/esm-infra-updates",
+            "dists/focal/InRelease",
+            None,
+        ),
+    ]