Revision a629ecb9 lib/luxi.py
b/lib/luxi.py | ||
---|---|---|
439 | 439 |
"""Send a generic request and return the response. |
440 | 440 |
|
441 | 441 |
""" |
442 |
if not isinstance(args, (list, tuple)): |
|
443 |
raise errors.ProgrammerError("Invalid parameter passed to CallMethod:" |
|
444 |
" expected list, got %s" % type(args)) |
|
442 | 445 |
return CallLuxiMethod(self._SendMethodCall, method, args, |
443 | 446 |
version=constants.LUXI_VERSION) |
444 | 447 |
|
445 | 448 |
def SetQueueDrainFlag(self, drain_flag): |
446 |
return self.CallMethod(REQ_QUEUE_SET_DRAIN_FLAG, drain_flag)
|
|
449 |
return self.CallMethod(REQ_QUEUE_SET_DRAIN_FLAG, (drain_flag, ))
|
|
447 | 450 |
|
448 | 451 |
def SetWatcherPause(self, until): |
449 |
return self.CallMethod(REQ_SET_WATCHER_PAUSE, [until])
|
|
452 |
return self.CallMethod(REQ_SET_WATCHER_PAUSE, (until, ))
|
|
450 | 453 |
|
451 | 454 |
def SubmitJob(self, ops): |
452 | 455 |
ops_state = map(lambda op: op.__getstate__(), ops) |
... | ... | |
459 | 462 |
return self.CallMethod(REQ_SUBMIT_MANY_JOBS, jobs_state) |
460 | 463 |
|
461 | 464 |
def CancelJob(self, job_id): |
462 |
return self.CallMethod(REQ_CANCEL_JOB, job_id)
|
|
465 |
return self.CallMethod(REQ_CANCEL_JOB, (job_id, ))
|
|
463 | 466 |
|
464 | 467 |
def ArchiveJob(self, job_id): |
465 |
return self.CallMethod(REQ_ARCHIVE_JOB, job_id)
|
|
468 |
return self.CallMethod(REQ_ARCHIVE_JOB, (job_id, ))
|
|
466 | 469 |
|
467 | 470 |
def AutoArchiveJobs(self, age): |
468 | 471 |
timeout = (DEF_RWTO - 1) / 2 |
... | ... | |
510 | 513 |
@rtype: L{objects.QueryResponse} |
511 | 514 |
|
512 | 515 |
""" |
513 |
req = objects.QueryRequest(what=what, fields=fields, qfilter=qfilter) |
|
514 |
result = self.CallMethod(REQ_QUERY, req.ToDict()) |
|
516 |
result = self.CallMethod(REQ_QUERY, (what, fields, qfilter)) |
|
515 | 517 |
return objects.QueryResponse.FromDict(result) |
516 | 518 |
|
517 | 519 |
def QueryFields(self, what, fields): |
... | ... | |
523 | 525 |
@rtype: L{objects.QueryFieldsResponse} |
524 | 526 |
|
525 | 527 |
""" |
526 |
req = objects.QueryFieldsRequest(what=what, fields=fields) |
|
527 |
result = self.CallMethod(REQ_QUERY_FIELDS, req.ToDict()) |
|
528 |
result = self.CallMethod(REQ_QUERY_FIELDS, (what, fields)) |
|
528 | 529 |
return objects.QueryFieldsResponse.FromDict(result) |
529 | 530 |
|
530 | 531 |
def QueryJobs(self, job_ids, fields): |
... | ... | |
546 | 547 |
return self.CallMethod(REQ_QUERY_CLUSTER_INFO, ()) |
547 | 548 |
|
548 | 549 |
def QueryConfigValues(self, fields): |
549 |
return self.CallMethod(REQ_QUERY_CONFIG_VALUES, fields)
|
|
550 |
return self.CallMethod(REQ_QUERY_CONFIG_VALUES, (fields, ))
|
|
550 | 551 |
|
551 | 552 |
def QueryTags(self, kind, name): |
552 | 553 |
return self.CallMethod(REQ_QUERY_TAGS, (kind, name)) |
Also available in: Unified diff