diff --git a/CHANGES/271.feature b/CHANGES/271.feature new file mode 100644 index 000000000..5d3ca7a65 --- /dev/null +++ b/CHANGES/271.feature @@ -0,0 +1 @@ +Added allow-uploads/block-uploads option to python distribution commands diff --git a/pulpcore/cli/python/distribution.py b/pulpcore/cli/python/distribution.py index d0d22b388..417597981 100644 --- a/pulpcore/cli/python/distribution.py +++ b/pulpcore/cli/python/distribution.py @@ -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, @@ -13,6 +13,7 @@ label_select_option, list_command, name_option, + pulp_option, resource_option, show_command, update_command, @@ -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)] diff --git a/tests/scripts/pulp_python/test_distribution.sh b/tests/scripts/pulp_python/test_distribution.sh index d0f9c544d..a8991c78c 100755 --- a/tests/scripts/pulp_python/test_distribution.sh +++ b/tests/scripts/pulp_python/test_distribution.sh @@ -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"