Change the results from cli.PollJob
authorIustin Pop <iustin@google.com>
Wed, 1 Oct 2008 08:29:16 +0000 (08:29 +0000)
committerIustin Pop <iustin@google.com>
Wed, 1 Oct 2008 08:29:16 +0000 (08:29 +0000)
Curently PollJob accepts a generic job, but will return (history
artifact) only the first opcode result. This is wrong, as it doesn't
allow polling of a job with multiple results.

Its only caller (for now) is also changed, so no functional changes
should happen.

Reviewed-by: ultrotter, amishchenko

lib/cli.py

index 226f453..71d010f 100644 (file)
@@ -452,7 +452,7 @@ def PollJob(job_id, cl=None, feedback_fn=None):
 
   status, result = jobs[0]
   if status == constants.JOB_STATUS_SUCCESS:
-    return result[0]
+    return result
   else:
     raise errors.OpExecError(result)
 
@@ -470,7 +470,9 @@ def SubmitOpCode(op, cl=None, feedback_fn=None):
 
   job_id = SendJob([op], cl)
 
-  return PollJob(job_id, cl=cl, feedback_fn=feedback_fn)
+  op_results = PollJob(job_id, cl=cl, feedback_fn=feedback_fn)
+
+  return op_results[0]
 
 
 def SubmitOrSend(op, opts, cl=None, feedback_fn=None):