Actions
Issue #5533
closedPulp incorrectly namespaces Detail model endpoints if there is no master viewset
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 60
Quarter:
Description
Context: https://www.redhat.com/archives/pulp-dev/2019-October/msg00021.html
Suppose you have a viewset for a Detail model that doesn't inherit from the Master viewset (ContentViewset in this case):
class DistributionTreeViewSet(NamedModelViewSet,
mixins.RetrieveModelMixin,
mixins.ListModelMixin,
mixins.DestroyModelMixin):
"""
Distribution Tree Viewset.
"""
endpoint_name = 'distribution_trees'
queryset = DistributionTree.objects.all()
serializer_class = DistributionTreeSerializer
Pulp will automatically try to define the endpoint using master_endpoint (which doesn't exist), app_label, and endpoint_name. In this case, this ends up being "/pulp/api/v3/distribution_trees/rpm/distribution_trees/" which is probably not what the plugin writer wants.
Actions
Fix Detail viewsets erroneous namespacing
If there is no Master viewset, don't automatically try to namespace the viewset endpoint as it erroneously namespaces the endpoint with the detail viewset's endpoint_name.
fixes #5533 https://pulp.plan.io/issues/5533