Implement โ€œgnt-job list -o +...โ€
authorIustin Pop <iustin@google.com>
Tue, 1 Jul 2008 09:48:56 +0000 (09:48 +0000)
committerIustin Pop <iustin@google.com>
Tue, 1 Jul 2008 09:48:56 +0000 (09:48 +0000)
This adds the same โ€œ-o +...โ€ functionality in gnt-job as in the node and
instance scripts.

Reviewed-by: imsnah

scripts/gnt-job

index e98f637..748a11c 100755 (executable)
@@ -33,12 +33,16 @@ from ganeti import utils
 from ganeti import errors
 
 
+_LIST_DEF_FIELDS = ["id", "status"]
+
 def ListJobs(opts, args):
   """List the jobs
 
   """
   if opts.output is None:
-    selected_fields = ["id", "status"]
+    selected_fields = _LIST_DEF_FIELDS
+  elif opts.output.startswith("+"):
+    selected_fields = _LIST_DEF_FIELDS + opts.output[1:].split(",")
   else:
     selected_fields = opts.output.split(",")
 
@@ -100,7 +104,7 @@ commands = {
            " (see the man page for details): id, status, op_list,"
            " op_status, op_result."
            " The default field"
-           " list is (in order): id, status."),
+           " list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS))
   }