From 76d64065762dc9adc1a2e612f0db5c20a6b7a88a Mon Sep 17 00:00:00 2001 From: Daniel Alley Date: Sun, 22 Jun 2025 16:58:22 -0400 Subject: [PATCH] Add initial plugin-specific support for "v4" API endpoints --- CHANGES/+v4-api.misc | 1 + pulp_deb/app/urls.py | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 CHANGES/+v4-api.misc diff --git a/CHANGES/+v4-api.misc b/CHANGES/+v4-api.misc new file mode 100644 index 000000000..97c08be8e --- /dev/null +++ b/CHANGES/+v4-api.misc @@ -0,0 +1 @@ +Started adding plugin-specific support for the Pulp "v4" API - these endpoints should not yet be considered actively supported. \ No newline at end of file diff --git a/pulp_deb/app/urls.py b/pulp_deb/app/urls.py index 679b06ecf..f02df494a 100644 --- a/pulp_deb/app/urls.py +++ b/pulp_deb/app/urls.py @@ -2,12 +2,28 @@ # If there are problems with the copy API, or domain support should be added, consult pulp_rpm. from django.conf import settings -from django.urls import path +from django.urls import path, include from .viewsets import CopyViewSet -V3_API_ROOT = settings.V3_API_ROOT_NO_FRONT_SLASH +if settings.DOMAIN_ENABLED: + V3_API_ROOT = settings.V3_DOMAIN_API_ROOT_NO_FRONT_SLASH +else: + V3_API_ROOT = settings.V3_API_ROOT_NO_FRONT_SLASH + +additional_deb_apis = [ + path("copy/", CopyViewSet.as_view({"post": "create"})), +] urlpatterns = [ - path(f"{V3_API_ROOT}deb/copy/", CopyViewSet.as_view({"post": "create"})), + path(f"{V3_API_ROOT}deb/", include(additional_deb_apis)), ] + +if getattr(settings, "ENABLE_V4_API", False): + V4_API_ROOT = settings.V4_DOMAIN_API_ROOT_NO_FRONT_SLASH + + additional_deb_apis = [ + path("copy/", CopyViewSet.as_view({"post": "create"}, name="deb-copy")), + ] + + path(f"{V4_API_ROOT}rpm/", include((additional_deb_apis, "deb"), namespace="v4"))