Skip to content

Commit

Permalink
Add allows-uploads/block-uploads option to python distribution commands
Browse files Browse the repository at this point in the history
fixes: #271
  • Loading branch information
gerrod3 authored and ggainey committed Jun 23, 2021
1 parent 7b69a38 commit eccd849
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/271.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added allow-uploads/block-uploads option to python distribution commands
8 changes: 7 additions & 1 deletion pulpcore/cli/python/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import click

from pulpcore.cli.common.context import PulpContext, pass_pulp_context
from pulpcore.cli.common.context import PluginRequirement, PulpContext, pass_pulp_context
from pulpcore.cli.common.generic import (
base_path_contains_option,
base_path_option,
Expand All @@ -13,6 +13,7 @@
label_select_option,
list_command,
name_option,
pulp_option,
resource_option,
show_command,
update_command,
Expand Down Expand Up @@ -53,6 +54,11 @@ def distribution(ctx: click.Context, pulp_ctx: PulpContext, distribution_type: s
click.option("--base-path"),
click.option("--publication"),
repository_option,
pulp_option(
"--allow-uploads/--block-uploads",
needs_plugins=[PluginRequirement("python", "3.4.0.dev")],
default=None,
),
]
create_options = update_options + [click.option("--name", required=True)]

Expand Down
8 changes: 8 additions & 0 deletions tests/scripts/pulp_python/test_distribution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ expect_succ pulp python distribution update \

expect_succ curl "$curl_opt" --head --fail "$PULP_BASE_URL/pulp/content/cli_test_python_distro/simple/"

if [ "$(pulp debug has-plugin --name "python" --min-version "3.4.0.dev")" = "true" ]
then
expect_succ pulp python distribution update \
--name "cli_test_python_distro" \
--repository "cli_test_python_repository" \
--block-uploads
fi

expect_succ pulp python distribution destroy --name "cli_test_python_distro"

0 comments on commit eccd849

Please sign in to comment.