Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add content list command #254

Merged
merged 1 commit into from
May 25, 2021
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/254.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added generic content list command.
2 changes: 2 additions & 0 deletions pulpcore/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pulpcore.cli.common import main
from pulpcore.cli.core.access_policy import access_policy
from pulpcore.cli.core.artifact import artifact
from pulpcore.cli.core.content import content
from pulpcore.cli.core.export import export
from pulpcore.cli.core.exporter import exporter
from pulpcore.cli.core.group import group
Expand All @@ -22,6 +23,7 @@
# Register commands with cli
main.add_command(access_policy)
main.add_command(artifact)
main.add_command(content)
main.add_command(export)
main.add_command(exporter)
main.add_command(group)
Expand Down
25 changes: 25 additions & 0 deletions pulpcore/cli/core/content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import gettext

import click

from pulpcore.cli.common.context import PulpContentContext, PulpContext, pass_pulp_context
from pulpcore.cli.common.generic import list_command

_ = gettext.gettext


@click.group()
@pass_pulp_context
@click.pass_context
def content(ctx: click.Context, pulp_ctx: PulpContext) -> None:
"""
Perform actions on all content units.

Please look for the plugin specific content commands for more detailed actions.
i.e. 'pulp file content <...>'
"""
pulp_ctx.needs_plugin("core", min_version="3.10")
ctx.obj = PulpContentContext(pulp_ctx)


content.add_command(list_command())
2 changes: 1 addition & 1 deletion pulpcore/cli/core/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def repository(ctx: click.Context, pulp_ctx: PulpContext) -> None:
Please look for the plugin specific repository commands for more detailed actions.
i.e. 'pulp file repository <...>'
"""
pulp_ctx.needs_plugin("core", min_version="3.10.dev")
pulp_ctx.needs_plugin("core", min_version="3.10")
ctx.obj = PulpRepositoryContext(pulp_ctx)


Expand Down
6 changes: 6 additions & 0 deletions tests/scripts/pulp_file/test_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ fi
expect_succ pulp file repository content remove --repository "cli_test_file_repository" --sha256 "$sha256" --relative-path upload_test/test.txt
expect_succ pulp file repository content list --repository "cli_test_file_repository"
test "$(echo "$OUTPUT" | jq -r length)" -eq "0"

if pulp debug has-plugin --name "core" --min-version "3.10"
then
expect_succ pulp content list
test "$(echo "$OUTPUT" | jq -r length)" -gt "0"
fi
2 changes: 1 addition & 1 deletion tests/scripts/pulp_file/test_repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ then
expect_succ pulp file repository update --name "cli_test_file_repo" --manifest "manifest.csv"
fi

if pulp debug has-plugin --name "core" --min-version "3.10.dev"
if pulp debug has-plugin --name "core" --min-version "3.10"
then
expect_succ pulp repository list
test "$(echo "$OUTPUT" | jq -r '.|length')" != "0"
Expand Down