Revision 3312709d lib/rapi/client.py

b/lib/rapi/client.py
1294 1294
                             ("/%s/instances/%s/console" %
1295 1295
                              (GANETI_RAPI_VERSION, instance)), None, None)
1296 1296

  
1297
  def GetJobs(self):
1297
  def GetJobs(self, bulk=False):
1298 1298
    """Gets all jobs for the cluster.
1299 1299

  
1300
    @type bulk: bool
1301
    @param bulk: Whether to return detailed information about jobs.
1300 1302
    @rtype: list of int
1301
    @return: job ids for the cluster
1303
    @return: List of job ids for the cluster or list of dicts with detailed
1304
             information about the jobs if bulk parameter was true.
1302 1305

  
1303 1306
    """
1304
    return [int(j["id"])
1305
            for j in self._SendRequest(HTTP_GET,
1306
                                       "/%s/jobs" % GANETI_RAPI_VERSION,
1307
                                       None, None)]
1307
    query = []
1308
    _AppendIf(query, bulk, ("bulk", 1))
1309

  
1310
    if bulk:
1311
      return self._SendRequest(HTTP_GET,
1312
                               "/%s/jobs" % GANETI_RAPI_VERSION,
1313
                               query, None)
1314
    else:
1315
      return [int(j["id"])
1316
              for j in self._SendRequest(HTTP_GET,
1317
                                         "/%s/jobs" % GANETI_RAPI_VERSION,
1318
                                         None, None)]
1308 1319

  
1309 1320
  def GetJobStatus(self, job_id):
1310 1321
    """Gets the status of a job.

Also available in: Unified diff