From 18c21ea4bf9288a2e8078709d8122f03eeca9fa0 Mon Sep 17 00:00:00 2001 From: Gerrod Ubben Date: Wed, 5 Feb 2025 11:31:46 -0500 Subject: [PATCH] Ensure compatibility with CONTENT_ORIGIN=None --- .github/workflows/scripts/install.sh | 2 +- pulp_python/app/pypi/views.py | 3 ++- pulp_python/app/utils.py | 3 ++- template_config.yml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index a512cbea..c63631d8 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -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: {"domain_enabled": true}\ +pulp_scenario_settings: {"content_origin": null, "domain_enabled": true}\ pulp_scenario_env: {}\ ' vars/main.yaml fi diff --git a/pulp_python/app/pypi/views.py b/pulp_python/app/pypi/views.py index 60b3c04d..b6210e2b 100644 --- a/pulp_python/app/pypi/views.py +++ b/pulp_python/app/pypi/views.py @@ -51,7 +51,8 @@ log = logging.getLogger(__name__) -BASE_CONTENT_URL = urljoin(settings.CONTENT_ORIGIN, settings.CONTENT_PATH_PREFIX) +ORIGIN_HOST = settings.CONTENT_ORIGIN if settings.CONTENT_ORIGIN else settings.PYPI_API_HOSTNAME +BASE_CONTENT_URL = urljoin(ORIGIN_HOST, settings.CONTENT_PATH_PREFIX) class PyPIMixin: diff --git a/pulp_python/app/utils.py b/pulp_python/app/utils.py index 19007ab6..c3d350fa 100644 --- a/pulp_python/app/utils.py +++ b/pulp_python/app/utils.py @@ -315,7 +315,8 @@ def find_artifact(): content_artifact = content.contentartifact_set.first() artifact = find_artifact() - origin = settings.CONTENT_ORIGIN.strip("/") + origin = settings.CONTENT_ORIGIN or settings.PYPI_API_HOSTNAME or "" + origin = origin.strip("/") prefix = settings.CONTENT_PATH_PREFIX.strip("/") base_path = base_path.strip("/") components = [origin, prefix, base_path, content.filename] diff --git a/template_config.yml b/template_config.yml index c7a5a0d4..3074bce9 100644 --- a/template_config.yml +++ b/template_config.yml @@ -47,6 +47,7 @@ pulp_settings: pypi_api_hostname: https://pulp:443 pulp_settings_azure: domain_enabled: true + content_origin: null pulp_settings_gcp: null pulp_settings_s3: domain_enabled: true