Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/1340.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `repair-metadata` command to `pulp python repository` for repairing package metadata.
1 change: 1 addition & 0 deletions CHANGES/pulp-glue/1340.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `repair_metadata` method to `PulpPythonRepositoryContext` for `pulp_python>=3.26.0`.
5 changes: 5 additions & 0 deletions pulp-glue/src/pulp_glue/python/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class PulpPythonRepositoryContext(PulpRepositoryContext):
CAPABILITIES = {
"sync": [PluginRequirement("python")],
"pulpexport": [PluginRequirement("python", specifier=">=3.11.0")],
"repair_metadata": [PluginRequirement("python", specifier=">=3.26.0")],
}
NEEDS_PLUGINS = [PluginRequirement("python", specifier=">=3.1.0")]

Expand All @@ -158,3 +159,7 @@ def preprocess_entity(self, body: EntityDefinition, partial: bool = False) -> En
if "autopublish" in body:
self.pulp_ctx.needs_plugin(PluginRequirement("python", specifier=">=3.3.0"))
return body

def repair_metadata(self) -> t.Any:
self.needs_capability("repair_metadata")
return self.call("repair_metadata", parameters={self.HREF: self.pulp_href})
21 changes: 21 additions & 0 deletions src/pulpcore/cli/python/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,24 @@ def sync(
)

repository_ctx.sync(body=body)


@repository.command()
@name_option
@href_option
@repository_lookup_option
@pass_repository_context
@pass_pulp_context
def repair_metadata(
pulp_ctx: PulpCLIContext,
repository_ctx: PulpRepositoryContext,
/,
) -> None:
"""
Repair the metadata for all immediate and on-demand packages in the latest version
of the specified repository. For immediate wheel packages, also repair metadata
artifacts derived from the main artifact.
"""
assert isinstance(repository_ctx, PulpPythonRepositoryContext)
result = repository_ctx.repair_metadata()
pulp_ctx.output_result(result)
5 changes: 5 additions & 0 deletions tests/scripts/pulp_python/test_repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ expect_succ test "$(echo "$OUTPUT" | jq -r '.remote')" = ""
expect_succ pulp python repository list
test "$(echo "$OUTPUT" | jq -r '.|length')" != "0"

if pulp debug has-plugin --name "python" --specifier ">=3.26.0"; then
expect_succ pulp python repository repair-metadata --repository "cli_test_python_repo"
expect_succ test "$(echo "$OUTPUT" | jq -r '.state')" = "completed"
fi

expect_succ pulp python repository destroy --name "cli_test_python_repo"
Loading