Revision eba1aaad

b/lib/client/gnt_job.py
218 218
    "opstart", "opexec", "opend", "received_ts", "start_ts", "end_ts",
219 219
    ]
220 220

  
221
  result = GetClient().QueryJobs(args, selected_fields)
221
  result = GetClient().Query(constants.QR_JOB, selected_fields,
222
                             qlang.MakeSimpleFilter("id", args)).data
222 223

  
223 224
  first = True
224 225

  
225
  for idx, entry in enumerate(result):
226
  for entry in result:
226 227
    if not first:
227 228
      format_msg(0, "")
228 229
    else:
229 230
      first = False
230 231

  
231
    if entry is None:
232
      if idx <= len(args):
233
        format_msg(0, "Job ID %s not found" % args[idx])
234
      else:
235
        # this should not happen, when we don't pass args it will be a
236
        # valid job returned
237
        format_msg(0, "Job ID requested as argument %s not found" % (idx + 1))
232
    ((_, job_id), (rs_status, status), (_, ops), (_, opresult), (_, opstatus),
233
     (_, oplog), (_, opstart), (_, opexec), (_, opend), (_, recv_ts),
234
     (_, start_ts), (_, end_ts)) = entry
235

  
236
    # Detect non-normal results
237
    if rs_status != constants.RS_NORMAL:
238
      format_msg(0, "Job ID %s not found" % job_id)
238 239
      continue
239 240

  
240
    (job_id, status, ops, opresult, opstatus, oplog,
241
     opstart, opexec, opend, recv_ts, start_ts, end_ts) = entry
242 241
    format_msg(0, "Job ID: %s" % job_id)
243 242
    if status in _USER_JOB_STATUS:
244 243
      status = _USER_JOB_STATUS[status]

Also available in: Unified diff