summaryrefslogtreecommitdiff
path: root/glanceclient/common/utils.py
diff options
context:
space:
mode:
authoryatin karel <yatin.karel@nectechnologies.in>2015-03-22 16:52:34 +0530
committeryatin karel <yatin.karel@nectechnologies.in>2015-03-22 17:26:55 +0530
commitc149a94ee1c8c5a04b984063cadf1dbc934eeb8b (patch)
treefefe230598d91dcb2f15210261184394da68c8b2 /glanceclient/common/utils.py
parent26280ed58b5d16feed4ab27be063d305ef48a252 (diff)
downloadpython-glanceclient-c149a94ee1c8c5a04b984063cadf1dbc934eeb8b.tar.gz
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
Diffstat (limited to 'glanceclient/common/utils.py')
-rw-r--r--glanceclient/common/utils.py4
1 files changed, 3 insertions, 1 deletions
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: