Skip to content

Commit d2ae90b

Browse files
committed
Revert "Add new repair_metadata endpoint"
This reverts commit fa784c4.
1 parent fa784c4 commit d2ae90b

File tree

5 files changed

+2
-155
lines changed

5 files changed

+2
-155
lines changed

CHANGES/805.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

pulp_python/app/tasks/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
"""
44

55
from .publish import publish # noqa:F401
6-
from .repair import repair # noqa:F401
76
from .sync import sync # noqa:F401
87
from .upload import upload, upload_group # noqa:F401

pulp_python/app/tasks/repair.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

pulp_python/app/viewsets.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PythonRepositoryViewSet(
8383
],
8484
},
8585
{
86-
"action": ["modify", "repair_metadata"],
86+
"action": ["modify"],
8787
"principal": "authenticated",
8888
"effect": "allow",
8989
"condition": [
@@ -122,26 +122,6 @@ class PythonRepositoryViewSet(
122122
"python.pythonrepository_viewer": ["python.view_pythonrepository"],
123123
}
124124

125-
@extend_schema(
126-
summary="Repair metadata",
127-
responses={202: AsyncOperationResponseSerializer},
128-
)
129-
@action(detail=True, methods=["post"], serializer_class=None)
130-
def repair_metadata(self, request, pk):
131-
"""
132-
<!-- User-facing documentation, rendered as html-->
133-
Trigger an asynchronous task to repair Python metadata. This task will repair metadata
134-
of all packages for the specified `Repository`, without creating a new `RepositoryVersion`.
135-
"""
136-
repository = self.get_object()
137-
138-
result = dispatch(
139-
tasks.repair,
140-
exclusive_resources=[repository],
141-
kwargs={"repository_pk": str(repository.pk)},
142-
)
143-
return core_viewsets.OperationPostponedResponse(result, request)
144-
145125
@extend_schema(
146126
summary="Sync from remote",
147127
responses={202: AsyncOperationResponseSerializer}

pulp_python/tests/functional/api/test_repair.py

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import pytest
22
import subprocess
3-
from urllib.parse import urljoin
43

5-
from pulp_python.tests.functional.constants import (
6-
PYTHON_EGG_FILENAME,
7-
PYTHON_FIXTURES_URL,
8-
)
4+
from pulp_python.tests.functional.constants import PYTHON_EGG_FILENAME
95

106

117
@pytest.fixture
@@ -80,47 +76,3 @@ def test_metadata_repair_command(
8076
assert content.packagetype == "sdist"
8177
assert content.requires_python == "" # technically null
8278
assert content.author == "Austin Macdonald"
83-
84-
85-
def test_metadata_repair_endpoint(
86-
create_content_direct,
87-
download_python_file,
88-
monitor_task,
89-
move_to_repository,
90-
python_bindings,
91-
python_repo,
92-
):
93-
"""
94-
Test repairing of package metadata via `Repository.repair_metadata` endpoint.
95-
"""
96-
python_egg_filename = "scipy-1.1.0.tar.gz"
97-
python_egg_url = urljoin(
98-
urljoin(PYTHON_FIXTURES_URL, "packages/"), python_egg_filename
99-
)
100-
python_file = download_python_file(python_egg_filename, python_egg_url)
101-
102-
data = {
103-
"name": "scipy",
104-
# Wrong metadata
105-
"author": "ME",
106-
"packagetype": "bdist",
107-
"requires_python": ">=3.8",
108-
"version": "0.2",
109-
}
110-
content = create_content_direct(python_file, python_egg_filename, data)
111-
for field, wrong_value in data.items():
112-
if field == "python_version":
113-
continue
114-
assert getattr(content, field) == wrong_value
115-
move_to_repository(python_repo.pulp_href, [content.pulp_href])
116-
117-
response = python_bindings.RepositoriesPythonApi.repair_metadata(
118-
python_repo.pulp_href
119-
)
120-
_ = monitor_task(response.task)
121-
122-
content = python_bindings.ContentPackagesApi.read(content.pulp_href)
123-
assert content.version == "1.1.0"
124-
assert content.packagetype == "sdist"
125-
assert content.requires_python == ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
126-
assert content.author == ""

0 commit comments

Comments
 (0)