Difference between loading via load merge vs confd_load?

Hi All!

We are using confd_load for a cli routine, the problem we are facing is the behavior with load merge is different from confd_load.

Following is what we are trying to do:

  1. Add an entry when the validation routine is hit {If already entry present throw error}
  2. When add is hit we make additional changes into the added entry during validation

When we did load merge 1 -> 2 and everything works fine…

When we did confd_load we see 1 -> 1 -> 2, i.e validation routine is called twice because of which validation fails and config fails. Please let us know why this difference in behaviour ?

What I could see is this validate routine is inside a list. and we do diff_iterate inside the validate routine. Btw I made one change added call-once after which it started working…

_tailf:call-once This optional_
statement can be used only if the parent statement is a list. If ‘call-once’ is ‘true’. the validation callback is only called once even though there exists many list entries in the data store. This is useful if we have a huge amount of instances or if values assigned to each instance have to be validated in comparison with its siblings.

I saw above from the doc and hence used the same, please let me know if my list entries are spread across in the config will it be able to accumulate all and call in one shot ?. Or will it accumulate the consecutive entries and then call ?. Please note this is for confd_load. Since I don’t see much queries on the same. I have made a detailed posting of my observation.


When you use confd_load, do you use the -m flag (for merge)? Note that the default for confd_load is delete and replace, which might explain why your validation code is called twice.

We are using -m, please find below the options we use…

confd_load -m -l -F c

Please find my explanation above, looks like since its a validate inside the list I see it hit multiple times. So here is some additional observation…

  1. load merge from the cli prompt looks like loading block by block.
    i.e lets say a list has 5 entries, when each entry loaded validate routine is called
    so when I do diff iterate I get only 1 element
  2. confd_load loads the config completley and then validate routines are called.
    i.e lets say a list has 5 entries, when I do confd_load all entries loaded
    when I do diff iterate in the validate routine all 5 entries are present
    if I don’t give call-once my validation callback is called 5 times,
    if I give call-once its called only once.