projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a generic write file function
[ganeti-local]
/
lib
/
cli.py
diff --git
a/lib/cli.py
b/lib/cli.py
index
85606d4
..
d1b6925
100644
(file)
--- a/
lib/cli.py
+++ b/
lib/cli.py
@@
-479,6
+479,9
@@
def GenerateTable(headers, fields, separator, data,
format_fields = []
for field in fields:
format_fields = []
for field in fields:
+ if headers and field not in headers:
+ raise errors.ProgrammerError("Missing header description for field '%s'"
+ % field)
if separator is not None:
format_fields.append("%s")
elif field in numfields:
if separator is not None:
format_fields.append("%s")
elif field in numfields:
@@
-501,6
+504,7
@@
def GenerateTable(headers, fields, separator, data,
pass
else:
val = row[idx] = utils.FormatUnit(val)
pass
else:
val = row[idx] = utils.FormatUnit(val)
+ val = row[idx] = str(val)
if separator is None:
mlens[idx] = max(mlens[idx], len(val))
if separator is None:
mlens[idx] = max(mlens[idx], len(val))