Skip to content

Commit 229ee6f

Browse files
committed
Add support for CONTENT_ORIGIN=None
fixes: #1910
1 parent 1f022c1 commit 229ee6f

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

.github/workflows/scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if [ "$TEST" = "azure" ]; then
110110
- ./azurite:/etc/pulp\
111111
command: "azurite-blob --blobHost 0.0.0.0"' vars/main.yaml
112112
sed -i -e '$a azure_test: true\
113-
pulp_scenario_settings: {"flatpak_index": true}\
113+
pulp_scenario_settings: {"content_origin": null, "flatpak_index": true}\
114114
pulp_scenario_env: {}\
115115
' vars/main.yaml
116116
fi

CHANGES/1910.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added support for pulpcore 3.70 `CONTENT_ORIGIN=None` feature.

pulp_container/app/redirects.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.core.exceptions import ObjectDoesNotExist
33
from django.shortcuts import redirect
44
from django.http import Http404
5+
from urllib.parse import urljoin
56

67
from pulp_container.app.exceptions import ManifestNotFound
78
from pulp_container.app.utils import get_accepted_media_types
@@ -26,7 +27,9 @@ def redirect_to_content_app(self, content_type, content_id):
2627
Redirect to the content app.
2728
"""
2829
return self.distribution.redirect_to_content_app(
29-
f"{settings.CONTENT_ORIGIN}/pulp/container/{self.path}/{content_type}/{content_id}"
30+
urljoin(
31+
settings.CONTENT_ORIGIN, f"/pulp/container/{self.path}/{content_type}/{content_id}"
32+
)
3033
)
3134

3235
def issue_manifest_redirect(self, manifest):

pulp_container/app/registry_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ def get(self, request):
691691
if images:
692692
results.append({"Name": distribution.base_path, "Images": images})
693693

694-
return Response(data={"Registry": settings.CONTENT_ORIGIN, "Results": results})
694+
host = settings.CONTENT_ORIGIN or request.get_host()
695+
return Response(data={"Registry": host, "Results": results})
695696

696697

697698
class FlatpakIndexStaticView(FlatpakIndexDynamicView):

template_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pulp_settings:
5454
flatpak_index: true
5555
pulp_settings_azure:
5656
flatpak_index: true
57+
content_origin: null
5758
pulp_settings_gcp: null
5859
pulp_settings_s3:
5960
flatpak_index: false

0 commit comments

Comments
 (0)