diff --git a/CHANGES/1305.feature b/CHANGES/1305.feature new file mode 100644 index 000000000..a524139e6 --- /dev/null +++ b/CHANGES/1305.feature @@ -0,0 +1 @@ +Change the default chunking value to "infinite". If users wants to, they can still specify a value based on their needs. \ No newline at end of file diff --git a/src/pulp_cli/generic.py b/src/pulp_cli/generic.py index 8e1369fcf..20cfdbb6b 100644 --- a/src/pulp_cli/generic.py +++ b/src/pulp_cli/generic.py @@ -717,7 +717,9 @@ def _callback( units = {"B": 1, "KB": 10**3, "MB": 10**6, "GB": 10**9, "TB": 10**12} -def parse_size_callback(ctx: click.Context, param: click.Parameter, value: str) -> int: +def parse_size_callback(ctx: click.Context, param: click.Parameter, value: str | None) -> int: + if value is None: + return 8 * 10**9 size = value.strip().upper() match = re.match(r"^([0-9]+)\s*([KMGT]?B)?$", size) if not match: @@ -1216,8 +1218,8 @@ def _type_callback(ctx: click.Context, param: click.Parameter, value: str | None chunk_size_option = pulp_option( "--chunk-size", - help=_("Chunk size to break up {entity} into. Defaults to 1MB"), - default="1MB", + help=_("Chunk size to break up {entity} into. Defaults to not chunking at all."), + default=None, callback=parse_size_callback, ) diff --git a/src/pulpcore/cli/ansible/content.py b/src/pulpcore/cli/ansible/content.py index ab2b918b6..97ac90e48 100644 --- a/src/pulpcore/cli/ansible/content.py +++ b/src/pulpcore/cli/ansible/content.py @@ -184,8 +184,8 @@ def content(ctx: click.Context, pulp_ctx: PulpCLIContext, /, content_type: str) @repository_option @pulp_option( "--chunk-size", - help=_("Chunk size to break up {entity} into. Defaults to 1MB"), - default="1MB", + help=_("Chunk size to break up {entity} into. Defaults to not chunking at all."), + default=None, callback=parse_size_callback, allowed_with_contexts=content_context, ) diff --git a/tests/test_help_pages.py b/tests/test_help_pages.py index 87e082cee..5be2a247c 100644 --- a/tests/test_help_pages.py +++ b/tests/test_help_pages.py @@ -32,7 +32,7 @@ def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t def pytest_generate_tests(metafunc: pytest.Metafunc) -> None: m = next(metafunc.definition.iter_markers("help_page"), None) if m is not None and "base_cmd" in m.kwargs: - rel_main:click.Group = main + rel_main: click.Group = main base_cmd = m.kwargs["base_cmd"] for step in base_cmd: sub = rel_main.commands[step]