mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-18 01:18:01 +08:00
expand units: Log missed bytes unit expansions
This commit is contained in:
parent
476fc636dd
commit
bd8e7e1925
1 changed files with 11 additions and 8 deletions
|
@ -402,14 +402,17 @@ def expand_units(object_config: dict, unexpand: bool = False) -> dict:
|
|||
"upload_speed",
|
||||
"download_speed",
|
||||
):
|
||||
if value:
|
||||
if unexpand:
|
||||
return BytesConverter(value).human_iec_bytes
|
||||
return BytesConverter(value)
|
||||
else:
|
||||
if unexpand:
|
||||
return BytesConverter(0).human_iec_bytes
|
||||
return BytesConverter(0)
|
||||
try:
|
||||
if value:
|
||||
if unexpand:
|
||||
return BytesConverter(value).human_iec_bytes
|
||||
return BytesConverter(value)
|
||||
else:
|
||||
if unexpand:
|
||||
return BytesConverter(0).human_iec_bytes
|
||||
return BytesConverter(0)
|
||||
except ValueError:
|
||||
logger.warning(f"Cannot parse bytes value {key}:\"{value}\", keeping as is")
|
||||
return value
|
||||
|
||||
return replace_in_iterable(object_config, _expand_units, callable_wants_key=True)
|
||||
|
|
Loading…
Add table
Reference in a new issue