From 53c04d04e433aea5c7b330e869e31ac3b59d0fdc Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 1 Oct 2008 08:29:16 +0000
Subject: [PATCH] Change the results from cli.PollJob

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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 226f45347..71d010f71 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -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):
-- 
GitLab