Skip to content

Commit

Permalink
Deprecated DELETE /pulp/api/v3/orphans/
Browse files Browse the repository at this point in the history
When calling this endpoint now, a deprecation warning is logged
recommending users instead use the `POST /pulp/api/v3/orphans/cleanup/`
call.

closes #8876
  • Loading branch information
bmbouter committed Jun 28, 2021
1 parent 8ad6aca commit 746b9d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES/8876.deprecation
@@ -0,0 +1,2 @@
Deprecated the ``DELETE /pulp/api/v3/orphans/`` call. Instead use the
``POST /pulp/api/v3/orphans/cleanup/`` call.
11 changes: 9 additions & 2 deletions pulpcore/app/views/orphans.py
@@ -1,6 +1,7 @@
from drf_spectacular.utils import extend_schema
from rest_framework.views import APIView

from pulpcore.app.loggers import deprecation_logger
from pulpcore.app.response import OperationPostponedResponse
from pulpcore.app.serializers import AsyncOperationResponseSerializer
from pulpcore.app.tasks import orphan_cleanup
Expand All @@ -9,15 +10,21 @@

class OrphansView(APIView):
@extend_schema(
description="Trigger an asynchronous task that deletes all"
"orphaned content and artifacts.",
description="DEPRECATED! Trigger an asynchronous task that deletes all "
"orphaned content and artifacts. Use the `POST /pulp/api/v3/orphans/cleanup/` call "
"instead.",
summary="Delete orphans",
responses={202: AsyncOperationResponseSerializer},
)
def delete(self, request, format=None):
"""
Cleans up all the Content and Artifact orphans in the system
"""
deprecation_logger.warning(
"The `DELETE /pulp/api/v3/orphans/` call is deprecated. Use"
"`POST /pulp/api/v3/orphans/cleanup/` instead."
)

task = dispatch(orphan_cleanup, [])

return OperationPostponedResponse(task, request)

0 comments on commit 746b9d8

Please sign in to comment.