Add gnt-cluster commands to toggle the master IP
[ganeti-local] / lib / client / gnt_job.py
index 9951928..4d888ad 100644 (file)
@@ -20,7 +20,7 @@
 
 """Job related commands"""
 
-# pylint: disable-msg=W0401,W0613,W0614,C0103
+# pylint: disable=W0401,W0613,W0614,C0103
 # W0401: Wildcard import ganeti.cli
 # W0613: Unused argument, since all functions follow the same API
 # W0614: Unused import %s from wildcard import (since we need cli)
@@ -40,7 +40,7 @@ _LIST_DEF_FIELDS = ["id", "status", "summary"]
 #: names
 _USER_JOB_STATUS = {
   constants.JOB_STATUS_QUEUED: "queued",
-  constants.JOB_STATUS_WAITLOCK: "waiting",
+  constants.JOB_STATUS_WAITING: "waiting",
   constants.JOB_STATUS_CANCELING: "canceling",
   constants.JOB_STATUS_RUNNING: "running",
   constants.JOB_STATUS_CANCELED: "canceled",
@@ -157,7 +157,7 @@ def AutoArchiveJobs(opts, args):
 
   age = args[0]
 
-  if age == 'all':
+  if age == "all":
     age = -1
   else:
     age = ParseTimespec(age)
@@ -317,6 +317,7 @@ def ShowJobs(opts, args):
         if not result:
           format_msg(3, "Result: empty dictionary")
         else:
+          format_msg(3, "Result:")
           for key, val in result.iteritems():
             format_msg(4, "%s: %s" % (key, result_helper(val)))
       else:
@@ -356,7 +357,7 @@ def WatchJob(opts, args):
 
 
 commands = {
-  'list': (
+  "list": (
     ListJobs, [ArgJobId()],
     [NOHDR_OPT, SEP_OPT, FIELDS_OPT],
     "[job_id ...]",
@@ -365,26 +366,32 @@ commands = {
     " op_status, op_result."
     " The default field"
     " list is (in order): %s." % utils.CommaJoin(_LIST_DEF_FIELDS)),
-  'archive': (
+  "archive": (
     ArchiveJobs, [ArgJobId(min=1)], [],
     "<job-id> [<job-id> ...]", "Archive specified jobs"),
-  'autoarchive': (
+  "autoarchive": (
     AutoArchiveJobs,
     [ArgSuggest(min=1, max=1, choices=["1d", "1w", "4w", "all"])],
     [],
     "<age>", "Auto archive jobs older than the given age"),
-  'cancel': (
+  "cancel": (
     CancelJobs, [ArgJobId(min=1)], [],
     "<job-id> [<job-id> ...]", "Cancel specified jobs"),
-  'info': (
+  "info": (
     ShowJobs, [ArgJobId(min=1)], [],
     "<job-id> [<job-id> ...]",
     "Show detailed information about the specified jobs"),
-  'watch': (
+  "watch": (
     WatchJob, [ArgJobId(min=1, max=1)], [],
     "<job-id>", "Follows a job and prints its output as it arrives"),
   }
 
 
+#: dictionary with aliases for commands
+aliases = {
+  "show": "info",
+  }
+
+
 def Main():
-  return GenericMain(commands)
+  return GenericMain(commands, aliases=aliases)