Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restconf: better error message for possible missing action node
There is a possible data race in sysrepo when calling actions. First, we check if the action node is present and then we executed the action. There is a possibility that between those two sysrepo calls the action node can be created or deleted. Fortunately, sysrepo raises and error when the action node is not present when performing the rpc call. Unfortunately, it is the same error as if the input data tree for the rpc was invalid. I was thinking about removing the check for the action node existence and rely solely on the sysrepo's exception. This would indeed remove the data race but the disadvantage is, that the error message is now very broad (in case of actions) because we can't differentiate between invalid input data and missing action node. I don't think this would bring a better behaviour from rousette. There are two possible scenarios with the current behaviour: 1) The data node gets created between the check and the rpc call. From the client's point of view the node does not exist in the moment the request is created and I *think* it is ok to reject it. 2) The data node gets deleted between the check and the rpc call. From the client's point of view the node was existing and it is expected to return something. However, sysrepo (and rousette) reports the validation failure error which is (at least) confusing. Therefore I have edited the error message to report this possibility as well. Bug: #2 Change-Id: Iae1a70160a8c5d32ed041ef90c4b67e18cd964c1
- Loading branch information