From ee69c97f9359ded528b9e6cabbbf03200ca5f7f1 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 6 Feb 2009 08:09:10 +0000
Subject: [PATCH] Fix rapi job listing

This patch fixes a couple of issues with the job listing:
  - in case of a non-existing job, nicely raise 404 instead of 500
  - in the job detail listing, also list the job log, the job
    timestamps, etc.
  - the opcode migrate instance was missing its description field

Reviewed-by: imsnah
---
 lib/opcodes.py    | 1 +
 lib/rapi/rlib2.py | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/opcodes.py b/lib/opcodes.py
index 44931c9d1..dea9d62d0 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -423,6 +423,7 @@ class OpMigrateInstance(OpCode):
 
   """
   OP_ID = "OP_INSTANCE_MIGRATE"
+  OP_DSC_FIELD = "instance_name"
   __slots__ = ["instance_name", "live", "cleanup"]
 
 
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index 91fc0202c..050ab660a 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -154,9 +154,14 @@ class R_2_jobs_id(baserlib.R_Generic):
             - opresult: OpCodes results as a list of lists
 
     """
-    fields = ["id", "ops", "status", "opstatus", "opresult"]
+    fields = ["id", "ops", "status", "summary",
+              "opstatus", "opresult", "oplog",
+              "received_ts", "start_ts", "end_ts",
+              ]
     job_id = self.items[0]
     result = luxi.Client().QueryJobs([job_id, ], fields)[0]
+    if result is None:
+      raise http.HttpNotFound()
     return baserlib.MapFields(fields, result)
 
   def DELETE(self):
-- 
GitLab