Commit dcbd6288 authored by Guido Trotter's avatar Guido Trotter

Fix gnt-job list argument handling

Currently QueryJob returns "None" when a wrong job ID is passed.
Handle this in gnt-job list, by printing an error for each wrong job,
and still giving output for all the jobs which actually do exist.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b4874c9e
......@@ -815,6 +815,8 @@ def GenerateTable(headers, fields, separator, data,
format = separator.replace("%", "%%").join(format_fields)
for row in data:
if row is None:
continue
for idx, val in enumerate(row):
if unitfields.Matches(fields[idx]):
try:
......@@ -840,6 +842,8 @@ def GenerateTable(headers, fields, separator, data,
for line in data:
args = []
if line is None:
line = ['-' for _ in fields]
for idx in xrange(len(fields)):
if separator is None:
args.append(mlens[idx])
......
......@@ -85,7 +85,11 @@ def ListJobs(opts, args):
headers = None
# change raw values to nicer strings
for row in output:
for row_id, row in enumerate(output):
if row is None:
ToStderr("No such job: %s" % args[row_id])
continue
for idx, field in enumerate(selected_fields):
val = row[idx]
if field == "status":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment