Skip to content

Commit

Permalink
Add support for CONTENT_ORIGIN=None
Browse files Browse the repository at this point in the history
fixes: #1910
  • Loading branch information
gerrod3 committed Feb 17, 2025
1 parent 1f022c1 commit 229ee6f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ if [ "$TEST" = "azure" ]; then
- ./azurite:/etc/pulp\
command: "azurite-blob --blobHost 0.0.0.0"' vars/main.yaml
sed -i -e '$a azure_test: true\
pulp_scenario_settings: {"flatpak_index": true}\
pulp_scenario_settings: {"content_origin": null, "flatpak_index": true}\
pulp_scenario_env: {}\
' vars/main.yaml
fi
Expand Down
1 change: 1 addition & 0 deletions CHANGES/1910.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for pulpcore 3.70 `CONTENT_ORIGIN=None` feature.
5 changes: 4 additions & 1 deletion pulp_container/app/redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
from django.http import Http404
from urllib.parse import urljoin

from pulp_container.app.exceptions import ManifestNotFound
from pulp_container.app.utils import get_accepted_media_types
Expand All @@ -26,7 +27,9 @@ def redirect_to_content_app(self, content_type, content_id):
Redirect to the content app.
"""
return self.distribution.redirect_to_content_app(
f"{settings.CONTENT_ORIGIN}/pulp/container/{self.path}/{content_type}/{content_id}"
urljoin(
settings.CONTENT_ORIGIN, f"/pulp/container/{self.path}/{content_type}/{content_id}"
)
)

def issue_manifest_redirect(self, manifest):
Expand Down
3 changes: 2 additions & 1 deletion pulp_container/app/registry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ def get(self, request):
if images:
results.append({"Name": distribution.base_path, "Images": images})

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


class FlatpakIndexStaticView(FlatpakIndexDynamicView):
Expand Down
1 change: 1 addition & 0 deletions template_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pulp_settings:
flatpak_index: true
pulp_settings_azure:
flatpak_index: true
content_origin: null
pulp_settings_gcp: null
pulp_settings_s3:
flatpak_index: false
Expand Down

0 comments on commit 229ee6f

Please sign in to comment.