Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/1305.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change the default chunking value to "infinite". If users wants to, they can still specify a value based on their needs.
8 changes: 5 additions & 3 deletions src/pulp_cli/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
)

Expand Down
4 changes: 2 additions & 2 deletions src/pulpcore/cli/ansible/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_help_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading