forked from pulp/pulp-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes pulp#144
- Loading branch information
David Davis
committed
Feb 15, 2021
1 parent
c1f1774
commit 2ae5461
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added worker command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import click | ||
|
||
from pulpcore.cli.common.context import ( | ||
PulpContext, | ||
pass_pulp_context, | ||
) | ||
from pulpcore.cli.common.generic import list_command, show_command, href_option, name_option | ||
from pulpcore.cli.core.context import PulpWorkerContext | ||
|
||
|
||
@click.group() | ||
@pass_pulp_context | ||
@click.pass_context | ||
def worker(ctx: click.Context, pulp_ctx: PulpContext) -> None: | ||
ctx.obj = PulpWorkerContext(pulp_ctx) | ||
|
||
|
||
filter_options = [ | ||
click.option("--name"), | ||
click.option("--name-contains", "name__contains"), | ||
click.option("--name-icontains", "name__icontains"), | ||
click.option("--missing/--not-missing", default=None), | ||
click.option("--online/--not-online", default=None), | ||
] | ||
|
||
worker.add_command(list_command(decorators=filter_options)) | ||
worker.add_command(show_command(decorators=[href_option, name_option])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck source=tests/scripts/config.source | ||
. "$(dirname "$(dirname "$(realpath "$0")")")"/config.source | ||
|
||
expect_succ pulp worker list | ||
href=$(echo $OUTPUT | jq -r ".[0].pulp_href") | ||
expect_succ pulp worker show --href "$href" | ||
|
||
expect_succ pulp worker list --missing | ||
expect_succ pulp worker list --not-missing | ||
expect_succ pulp worker list --online | ||
expect_succ pulp worker list --not-online | ||
expect_succ pulp worker list --name "resource-manager" | ||
|
||
if pulp debug has-plugin --name "pulpcore" --min-version "3.10.0" | ||
then | ||
expect_succ pulp worker list --name-contains "resource" | ||
fi |