Commit d21eda27 authored by Guido Trotter's avatar Guido Trotter
Browse files

ConfdProcessor: move verification to __init__

During a query execution we currently verify whether we have that query
supported in our dispatch table. Since it's an error not to have it
anyway, we move this verification to the class creation, erroring out
early if such a problem exists.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent e16e4824
......@@ -57,6 +57,9 @@ class ConfdProcessor(object):
self.reader = reader
self.hmac_key = utils.ReadFile(constants.HMAC_CLUSTER_KEY)
assert \
not constants.CONFD_REQS.symmetric_difference(self.DISPATCH_TABLE), \
"DISPATCH_TABLE is unaligned with CONFD_REQS"
def ExecQuery(self, payload_in, ip, port):
"""Process a single UDP request from a client.
......@@ -131,10 +134,6 @@ class ConfdProcessor(object):
msg = "missing requested salt"
raise errors.ConfdRequestError(msg)
if request.type not in self.DISPATCH_TABLE:
msg = "Valid request %d not in DISPATCH_TABLE" % request.type
raise errors.ProgrammerError(msg)
query_object = self.DISPATCH_TABLE[request.type](self.reader)
status, answer = query_object.Exec(request.query)
reply = objects.ConfdReply(
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