Revision a629ecb9 lib/server/masterd.py
b/lib/server/masterd.py | ||
---|---|---|
193 | 193 |
queue = self.server.context.jobqueue |
194 | 194 |
|
195 | 195 |
# TODO: Parameter validation |
196 |
if not isinstance(args, (tuple, list)): |
|
197 |
logging.info("Received invalid arguments of type '%s'", type(args)) |
|
198 |
raise ValueError("Invalid arguments type '%s'" % type(args)) |
|
196 | 199 |
|
197 | 200 |
# TODO: Rewrite to not exit in each 'if/elif' branch |
198 | 201 |
|
... | ... | |
209 | 212 |
return queue.SubmitManyJobs(jobs) |
210 | 213 |
|
211 | 214 |
elif method == luxi.REQ_CANCEL_JOB: |
212 |
job_id = args
|
|
215 |
(job_id, ) = args
|
|
213 | 216 |
logging.info("Received job cancel request for %s", job_id) |
214 | 217 |
return queue.CancelJob(job_id) |
215 | 218 |
|
216 | 219 |
elif method == luxi.REQ_ARCHIVE_JOB: |
217 |
job_id = args
|
|
220 |
(job_id, ) = args
|
|
218 | 221 |
logging.info("Received job archive request for %s", job_id) |
219 | 222 |
return queue.ArchiveJob(job_id) |
220 | 223 |
|
... | ... | |
231 | 234 |
prev_log_serial, timeout) |
232 | 235 |
|
233 | 236 |
elif method == luxi.REQ_QUERY: |
234 |
req = objects.QueryRequest.FromDict(args) |
|
237 |
(what, fields, qfilter) = args |
|
238 |
req = objects.QueryRequest(what=what, fields=fields, qfilter=qfilter) |
|
235 | 239 |
|
236 | 240 |
if req.what in constants.QR_VIA_OP: |
237 | 241 |
result = self._Query(opcodes.OpQuery(what=req.what, fields=req.fields, |
... | ... | |
249 | 253 |
return result |
250 | 254 |
|
251 | 255 |
elif method == luxi.REQ_QUERY_FIELDS: |
252 |
req = objects.QueryFieldsRequest.FromDict(args) |
|
256 |
(what, fields) = args |
|
257 |
req = objects.QueryFieldsRequest(what=what, fields=fields) |
|
253 | 258 |
|
254 | 259 |
try: |
255 | 260 |
fielddefs = query.ALL_FIELDS[req.what] |
... | ... | |
298 | 303 |
return self._Query(op) |
299 | 304 |
|
300 | 305 |
elif method == luxi.REQ_QUERY_EXPORTS: |
301 |
nodes, use_locking = args
|
|
306 |
(nodes, use_locking) = args
|
|
302 | 307 |
if use_locking: |
303 | 308 |
raise errors.OpPrereqError("Sync queries are not allowed", |
304 | 309 |
errors.ECODE_INVAL) |
... | ... | |
307 | 312 |
return self._Query(op) |
308 | 313 |
|
309 | 314 |
elif method == luxi.REQ_QUERY_CONFIG_VALUES: |
310 |
fields = args
|
|
315 |
(fields, ) = args
|
|
311 | 316 |
logging.info("Received config values query request for %s", fields) |
312 | 317 |
op = opcodes.OpClusterConfigQuery(output_fields=fields) |
313 | 318 |
return self._Query(op) |
... | ... | |
318 | 323 |
return self._Query(op) |
319 | 324 |
|
320 | 325 |
elif method == luxi.REQ_QUERY_TAGS: |
321 |
kind, name = args
|
|
326 |
(kind, name) = args
|
|
322 | 327 |
logging.info("Received tags query request") |
323 | 328 |
op = opcodes.OpTagsGet(kind=kind, name=name) |
324 | 329 |
return self._Query(op) |
... | ... | |
331 | 336 |
return self.server.context.glm.OldStyleQueryLocks(fields) |
332 | 337 |
|
333 | 338 |
elif method == luxi.REQ_QUEUE_SET_DRAIN_FLAG: |
334 |
drain_flag = args
|
|
339 |
(drain_flag, ) = args
|
|
335 | 340 |
logging.info("Received queue drain flag change request to %s", |
336 | 341 |
drain_flag) |
337 | 342 |
return queue.SetDrainFlag(drain_flag) |
Also available in: Unified diff