X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/26f15862d6dd3ab2ea34de066c8c789a649d70f1..cd098c41522469e462efeb1e157a8718ff7b7809:/scripts/gnt-job diff --git a/scripts/gnt-job b/scripts/gnt-job index 9b22a29..2da75a3 100755 --- a/scripts/gnt-job +++ b/scripts/gnt-job @@ -64,7 +64,7 @@ def ListJobs(opts, args): else: selected_fields = opts.output.split(",") - output = GetClient().QueryJobs(None, selected_fields) + output = GetClient().QueryJobs(args, selected_fields) if not opts.no_headers: # TODO: Implement more fields headers = { @@ -84,12 +84,12 @@ def ListJobs(opts, args): else: headers = None - # we don't have yet unitfields here - unitfields = None - numfields = 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": @@ -107,8 +107,7 @@ def ListJobs(opts, args): row[idx] = str(val) data = GenerateTable(separator=opts.separator, headers=headers, - fields=selected_fields, unitfields=unitfields, - numfields=numfields, data=output, units=opts.units) + fields=selected_fields, data=output) for line in data: ToStdout(line) @@ -314,9 +313,10 @@ def ShowJobs(opts, args): commands = { - 'list': (ListJobs, ARGS_NONE, - [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], - "", "List the jobs and their status. The available fields are" + 'list': (ListJobs, ARGS_ANY, + [DEBUG_OPT, NOHDR_OPT, SEP_OPT, FIELDS_OPT], + "[job_id ...]", + "List the jobs and their status. The available fields are" " (see the man page for details): id, status, op_list," " op_status, op_result." " The default field"