Commit 64d7e30f authored by Klaus Aehlig's avatar Klaus Aehlig

Change method dispatch in ClientOps to enforce luxi.REQ_ALL

ClientOps' handle_request dispatches on the luxi request received. Change
this to first verify if the request is luxi.REQ_ALL. In this way, we catch
programming errors introducing "secret" luxi requests earlier. This is relevant,
as our other checks for internal consistency compare against luxi.REQ_ALL.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 75f2ff7d
......@@ -279,6 +279,10 @@ class ClientOps:
logging.info("Received invalid arguments of type '%s'", type(args))
raise ValueError("Invalid arguments type '%s'" % type(args))
if method not in luxi.REQ_ALL:
logging.info("Received invalid request '%s'", method)
raise ValueError("Invalid operation '%s'" % method)
# TODO: Rewrite to not exit in each 'if/elif' branch
if method == luxi.REQ_SUBMIT_JOB:
......@@ -446,8 +450,9 @@ class ClientOps:
return _SetWatcherPause(context, until)
else:
logging.info("Received invalid request '%s'", method)
raise ValueError("Invalid operation '%s'" % method)
logging.critical("Request '%s' in luxi.REQ_ALL, but not known", method)
raise errors.ProgrammerError("Operation '%s' in luxi.REQ_ALL,"
" but not implemented" % method)
def _Query(self, op):
"""Runs the specified opcode and returns the result.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment