Skip to content

Commit

Permalink
Add task-group command group
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
mdellweg committed Apr 26, 2021
1 parent 0158b85 commit 0720bee
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/211.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the task-group subcommand.
2 changes: 2 additions & 0 deletions pulpcore/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pulpcore.cli.core.show import show
from pulpcore.cli.core.status import status
from pulpcore.cli.core.task import task
from pulpcore.cli.core.task_group import task_group
from pulpcore.cli.core.user import user
from pulpcore.cli.core.worker import worker

Expand All @@ -31,5 +32,6 @@
main.add_command(show)
main.add_command(status)
main.add_command(task)
main.add_command(task_group)
main.add_command(user)
main.add_command(worker)
7 changes: 7 additions & 0 deletions pulpcore/cli/core/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ def scope(self) -> Dict[str, Any]:
return {}


class PulpTaskGroupContext(PulpEntityContext):
ENTITY = "task group"
HREF = "task_group_href"
LIST_ID = "task_groups_list"
READ_ID = "task_groups_read"


class PulpUploadContext(PulpEntityContext):
ENTITY = "upload"
HREF = "upload_href"
Expand Down
2 changes: 1 addition & 1 deletion pulpcore/cli/core/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def list(
exporter: str,
limit: int,
offset: int,
**kwargs: Any
**kwargs: Any,
) -> None:
params = {k: v for k, v in kwargs.items() if v is not None}
exporter_ctx = PulpExporterContext(pulp_ctx)
Expand Down
20 changes: 20 additions & 0 deletions pulpcore/cli/core/task_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import gettext

import click

from pulpcore.cli.common.context import PulpContext, pass_pulp_context
from pulpcore.cli.common.generic import href_option, list_command, show_command
from pulpcore.cli.core.context import PulpTaskGroupContext

_ = gettext.gettext


@click.group()
@pass_pulp_context
@click.pass_context
def task_group(ctx: click.Context, pulp_ctx: PulpContext) -> None:
ctx.obj = PulpTaskGroupContext(pulp_ctx)


task_group.add_command(list_command())
task_group.add_command(show_command(decorators=[href_option]))

0 comments on commit 0720bee

Please sign in to comment.