From 8bb55abcea0802d0b0df405e7ef6d023fc9de9d0 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 3 Sep 2025 12:17:04 +0200 Subject: [PATCH] Fixed a bug on distribution create Due to a recent pulpcore change, the distribution serializer must be able to serialize in the task context where the request is set to none. (cherry picked from commit b9606cb87d96f6d822041babdf4ad94687b9a553) --- CHANGES/+distribution_create.bugfix | 1 + pulp_container/app/serializers.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 CHANGES/+distribution_create.bugfix diff --git a/CHANGES/+distribution_create.bugfix b/CHANGES/+distribution_create.bugfix new file mode 100644 index 000000000..46a2e72b7 --- /dev/null +++ b/CHANGES/+distribution_create.bugfix @@ -0,0 +1 @@ +Fixed a bug on distribution create that failed to serialize the full registry path in the task context. diff --git a/pulp_container/app/serializers.py b/pulp_container/app/serializers.py index 134670386..6ebca247b 100644 --- a/pulp_container/app/serializers.py +++ b/pulp_container/app/serializers.py @@ -228,8 +228,11 @@ def to_representation(self, value): """ Converts a base_path into a registry path. """ - request = self.context["request"] - return f"{request.get_host()}/{get_full_path(value)}" + request = self.context.get("request") + if request is not None: + return f"{request.get_host()}/{get_full_path(value)}" + else: + return get_full_path(value) class ContainerNamespaceSerializer(ModelSerializer, GetOrCreateSerializerMixin):