Open
Description
Using the latest sysrepo
version I started getting the following errors. It is caused by change of sysrepo API of functions sr_rpc_send*, where return value can be NULL
. This is typically the case of rpc/action not returning any output. However, now is NULL
correct value meaning that no output node is generated:
[out] output SR data with the output data tree, NULL if no output nodes were generated.
Error:
self = <sysrepo.session.SysrepoSession object at 0x7767f34fb780>
rpc_input = <[AttributeError("cdata 'void *' has no attribute 'schema'") raised in repr()] DContainer object at 0x7767f3022b70>
timeout_ms = 0
def rpc_send_ly(
self, rpc_input: libyang.DNode, timeout_ms: int = 0
) -> libyang.DNode:
"""
Send an RPC/action and wait for the result.
RPC/action must be valid in (is validated against) the operational datastore
context.
:arg rpc_input:
The RPC/action input tree. It is *NOT* spent and must be freed by the
caller.
:arg timeout_ms:
RPC/action callback timeout in milliseconds. If 0, default is used.
:returns:
The RPC/action output tree. Allocated dynamically and must be freed by the
caller.
:raises SysrepoError:
If the RPC/action callback failed.
"""
if not isinstance(rpc_input, libyang.DNode):
raise TypeError("rpc_input must be a libyang.DNode")
# libyang and sysrepo bindings are different, casting is required
in_dnode = ffi.cast("struct lyd_node *", rpc_input.cdata)
sr_data_p = ffi.new("sr_data_t **")
check_call(lib.sr_rpc_send_tree, self.cdata, in_dnode, timeout_ms, sr_data_p)
if not sr_data_p[0]:
> raise SysrepoInternalError("sr_rpc_send_tree returned NULL")
E sysrepo.errors.SysrepoInternalError: sr_rpc_send_tree returned NULL: Internal error
/lib/python3.11/site-packages/sysrepo/session.py:1473: SysrepoInternalError
Metadata
Metadata
Assignees
Labels
No labels