Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V2] Add warning for invalid max-items value #8855

Open
wants to merge 21 commits into
base: v2
Choose a base branch
from

Conversation

aemous
Copy link
Contributor

@aemous aemous commented Aug 8, 2024

Description of changes:
Explicitly warn users that we do not support non-positive values for the max-items global pagination argument.

Example output:

aws s3api list-objects --bucket bucket-123 --max-items 0
2024-08-08 12:11:58,993 - awscli.customizations.paginate - CRITICAL - Non-positive values for --max-items are unsupported and may yield undefined behavior.

{
    "RequestCharged": null
} 

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@hssyoo hssyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start! You've got the right idea, I just had a couple suggestions on where to do the validation.

awscli/customizations/paginate.py Outdated Show resolved Hide resolved
awscli/customizations/paginate.py Outdated Show resolved Hide resolved
tests/integration/test_smoke.py Outdated Show resolved Hide resolved
tests/unit/customizations/test_paginate.py Show resolved Hide resolved
.changes/next-release/enhancement-paginator-41862.json Outdated Show resolved Hide resolved
awscli/customizations/paginate.py Outdated Show resolved Hide resolved
tests/unit/customizations/test_paginate.py Outdated Show resolved Hide resolved
@aemous
Copy link
Contributor Author

aemous commented Sep 18, 2024

Iterated on all requested feedback. If this looks good I'll open a V1 version with the same code. @hssyoo

tests/unit/customizations/test_paginate.py Outdated Show resolved Hide resolved
awscli/customizations/paginate.py Outdated Show resolved Hide resolved
@aemous
Copy link
Contributor Author

aemous commented Sep 18, 2024

Iterated on all requested feedback. If this looks good I'll open a V1 version with the same code. @hssyoo

Comment on lines 342 to 344
uni_print(
"warning: Non-positive values for --max-items may result in undefined behavior.\n",
sys.stderr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The formatting looks off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in latest revision. Please let me know if we have a formatter / formatting guide anywhere for this repository. I kept it split into 2 lines to avoid too-long of a line but not sure if we have formal requirements on that anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants