improved printout

This commit is contained in:
John Lancaster
2024-06-03 20:52:52 -05:00
parent 2e2a777b11
commit 4e7fa8c87a

View File

@@ -23,6 +23,8 @@ def convert_size(size_str: str) -> int:
scale = 8589934592 scale = 8589934592
elif size_str.endswith('MiB'): elif size_str.endswith('MiB'):
scale = 8388608 scale = 8388608
else:
scale = 1
return int(round(base_size * scale)) return int(round(base_size * scale))
@@ -48,7 +50,7 @@ def prune(loki_url: str = None, dry_run: bool = False):
sys.exit(1) sys.exit(1)
d = {f['name']: {'blobs': f['blobs'], 'size': f['size']} for f in field_gen(result.stdout)} d = {f['name']: {'blobs': f['blobs'], 'size': f['size']} for f in field_gen(result.stdout)}
console.print(d) logger.debug(json.dumps(d, indent=4))
if loki_url is not None and not dry_run: if loki_url is not None and not dry_run:
send_to_loki(loki_url, line=json.dumps(d), backup='prune') send_to_loki(loki_url, line=json.dumps(d), backup='prune')