From c149a94ee1c8c5a04b984063cadf1dbc934eeb8b Mon Sep 17 00:00:00 2001 From: yatin karel Date: Sun, 22 Mar 2015 16:52:34 +0530 Subject: glance image-show now have --human-readable option Added option '--human-readable' to image-show cli which allows users to display image size in human-readable format. Change-Id: Ic3452ce4560d3cf90fa7f59f98e5ff42e804f8c9 Closes-Bug: #1434381 --- glanceclient/common/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'glanceclient/common/utils.py') diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index e51643f..b199bf3 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -372,10 +372,12 @@ def strip_version(endpoint): return endpoint, version -def print_image(image_obj, max_col_width=None): +def print_image(image_obj, human_readable=False, max_col_width=None): ignore = ['self', 'access', 'file', 'schema'] image = dict([item for item in six.iteritems(image_obj) if item[0] not in ignore]) + if human_readable: + image['size'] = make_size_human_readable(image['size']) if str(max_col_width).isdigit(): print_dict(image, max_column_width=max_col_width) else: -- cgit v1.2.1