Skip to content
Snippets Groups Projects
Commit 60154921 authored by Iustin Pop's avatar Iustin Pop
Browse files

Extend RPC definition change with another parameter


This will be used in a later patch for parameter pre-processing. For
now we just add the parameter as 'None' and add a consistency check
for the parameter definitions.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 527c0cf7
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,9 @@ from ganeti import build
_SINGLE = "single-node"
_MULTI = "multi-node"
#: Expected length of a rpc definition
_RPC_DEF_LEN = 7
def _WritePreamble(sw):
"""Writes a preamble for the RPC wrapper output.
......@@ -117,7 +120,12 @@ def _WriteBaseClass(sw, clsname, calls):
sw.Write("_CALLS = rpc_defs.CALLS[%r]", clsname)
sw.Write("")
for (name, kind, timeout, args, _, desc) in calls:
for v in calls:
if len(v) != _RPC_DEF_LEN:
raise ValueError("Procedure %s has only %d elements, expected %d" %
(v[0], len(v), _RPC_DEF_LEN))
for (name, kind, timeout, args, _, _, desc) in calls:
funcargs = ["self"]
if kind == _SINGLE:
......
......@@ -434,7 +434,7 @@ class _RpcClientBase:
"""Entry point for automatically generated RPC wrappers.
"""
(procedure, _, timeout, argdefs, postproc_fn, _) = cdef
(procedure, _, timeout, argdefs, _, postproc_fn, _) = cdef
if callable(timeout):
read_timeout = timeout(args)
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment