Is your feature request related to a problem? Please describe.
The stringutils.human_to_bytes utility is pretty narrow in its implementation. It doesn't handle sizes above a petabyte, and also doesn't handle units specified in more than a character (KB or KiB vs K).
Describe the solution you'd like
The virt module has a _handle_unit function that handles this functionality pretty well. This function could be moved over to replace human_to_bytes, centralizing and improving the logic. It'd also be great to have this as a Jinja filter.
Describe alternatives you've considered
Just deal with it? 😉 It works as-is... it's just picky about input.
Additional context
Stumbled upon this while looking at file.tidied, which only accepts sizes in bytes.
Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.
Is your feature request related to a problem? Please describe.
The
stringutils.human_to_bytesutility is pretty narrow in its implementation. It doesn't handle sizes above a petabyte, and also doesn't handle units specified in more than a character (KB or KiB vs K).Describe the solution you'd like
The
virtmodule has a_handle_unitfunction that handles this functionality pretty well. This function could be moved over to replacehuman_to_bytes, centralizing and improving the logic. It'd also be great to have this as a Jinja filter.Describe alternatives you've considered
Just deal with it? 😉 It works as-is... it's just picky about input.
Additional context
Stumbled upon this while looking at
file.tidied, which only accepts sizes in bytes.Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.