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

Clarify wording of human_to_bytes filter #82074

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

leegarrett
Copy link
Contributor

SUMMARY

Minor Improvement of wording to clarify that it always uses multiple of 1024 (and not 1000).

ISSUE TYPE
  • Docs Pull Request

@ansibot ansibot added the needs_triage Needs a first human triage before being processed. label Oct 25, 2023
@@ -4,10 +4,11 @@ DOCUMENTATION:
short_description: Get bytes from string
description:
- Convert a human-readable byte or bit string into a number bytes.
- Will always use base 2 (1024) for the unit prefix, e.g 1 KB is 1024, 1MB is 1048576, etc.
Copy link
Member

Choose a reason for hiding this comment

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

this is incorrect, see when "b" is added or isbits option is used. At best you should say ' it defaults to the isbits value if no identifier is present'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might be a bug, but 12b will parse to 12 when isbits=false. Any unit prefixes, e.g. 12kb will then throw an error: 'human_to_bytes() can''t interpret following string: 12kb'.

With isbits=true, 12kb will still evaluate to 13312, so it's still correctly uses 1024. No conversion between bytes and bits happens in that code.

So I guess the line above the one added is incorrect, though, as it doesn't convert a bit string to a number bytes.

@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Oct 26, 2023
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 2, 2023
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants