Update value on same leaf

Hi Expert’s,

I have followed the transaction hook from the below path of example confd codes,
. /examples.confd/intro/python/11-hooks

While the execution I was able to add values to an empty leaf.
The commands as follows.

Here I have given only Ip and Netmask where the gateway have been configured automatically by the “hooks.py” script using transaction hook


Finally, I was getting Confd_Ok from CDB.


I had modified the script accordingly

Before modification :


After modification:


Here I have changed in path into ip in place of gw(gateway).
During the time of execution, there is no response for few moments later an error encountered as displayed below.


On the whole I want to know how to update the value of a same leaf.

When user in CLI modifies “ip” leaf:

  1. ConfD invokes set-hook callback code - cb_set_elem(...)
  2. your modified code in there tries to modify “ip” leaf
  3. ConfD tries to invoke to modify the “ip”, which invokes hook code
  4. Python daemon with set-hook callback is blocked by still processing 1)…

which leads to deadlock, and subsequently timeout…

Are you sure you want to modify “ip” when processing “ip”? This feels like wrong mapping of data. Maybe if you specify why you need different value (use-case), we may identify proper approach -> it feels strange to do something else on direct CDB data when what users tells CLI to do…

One approach could be “action” statement (https://datatracker.ietf.org/doc/html/rfc7950#page-113) -> with input parameters, to create/modify records in CDB with expected values.

Other way is using “transformation” (ConfD user guide - chapter 12) of YANG model, but it brings in more complexity.