diff options
author | John Estabrook <jestabro@vyos.io> | 2023-10-20 23:47:20 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-12-16 20:37:10 -0600 |
commit | 06832e3cc962eb4f94afe5319e7416d68756dba9 (patch) | |
tree | 94f4ae62796c6ff011c687ee902d7ee8fa9f2949 /src/op_mode | |
parent | c3d2e02898259190d107127d867f9e16a2b84f1f (diff) | |
download | vyos-1x-06832e3cc962eb4f94afe5319e7416d68756dba9.tar.gz vyos-1x-06832e3cc962eb4f94afe5319e7416d68756dba9.zip |
image: T4516: improve format of 'show system image details'
(cherry picked from commit 8efab9ee8cdb0e65dddb9d3ba97de8ddcf3666dc)
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/image_info.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/op_mode/image_info.py b/src/op_mode/image_info.py index ae0677196..14dca7476 100755 --- a/src/op_mode/image_info.py +++ b/src/op_mode/image_info.py @@ -20,11 +20,11 @@ import sys from typing import List, Union -from hurry.filesize import size from tabulate import tabulate from vyos import opmode from vyos.system import disk, grub, image +from vyos.utils.convert import bytes_to_human def _format_show_images_summary(images_summary: image.BootDetails) -> str: @@ -58,11 +58,15 @@ def _format_show_images_details( for image_item in images_details: name: str = image_item.get('name') version: str = image_item.get('version') - disk_ro: int = size(image_item.get('disk_ro')) - disk_rw: int = size(image_item.get('disk_rw')) - disk_total: int = size(image_item.get('disk_total')) + disk_ro: str = bytes_to_human(image_item.get('disk_ro'), + precision=1, int_below_exponent=30) + disk_rw: str = bytes_to_human(image_item.get('disk_rw'), + precision=1, int_below_exponent=30) + disk_total: str = bytes_to_human(image_item.get('disk_total'), + precision=1, int_below_exponent=30) table_data.append([name, version, disk_ro, disk_rw, disk_total]) - tabulated: str = tabulate(table_data, headers) + tabulated: str = tabulate(table_data, headers, + colalign=('left', 'left', 'right', 'right', 'right')) return tabulated |