Re: mergedata, etc.: what happens with duplicate keys?
Bas van der Vlies <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
David,
the cf_surfsara_lib also depends a lot of mergdate. The last one wins, see for a small example:
* https://github.com/basvandervlies/cf_surfsara_lib#mustachejson-rules
regards
> On 31 Jul 2021, at 13:43, [email protected] <[email protected]> wrote:
>
> All the documentation and examples about "mergedata" (and bundle "cmerge", etc.) seem to be based on non-overlapping data sets. For example, with two simple key:value JSON datasets, the examples and documentation have no overlap of keys.
>
> But what is supposed to happen when the same key, and with potentially different value, appears in both JSON datasets?
>
> My proposed use-case is two simple JSON key:value datasets. The first can be regarded as a full and complete set of default key:value pairs; the second is smaller and contains override values for a subset of those same keys. The desired result would be that full set as modified by the overrides.
>
> There seems to be no documentation describing how this is handled, not even whether it is regarded as an error condition. If it is documented somewhere, it seems well hidden.
>
> If I should be using something else rather than "mergedata", let me know.
>
> Any thoughts? Primarily about my proposed use-case, but also about improving the documentation (e.g. at function "mergedata") to describe this case of same-key merging.
>
> Assume CFE 3.12, but if CFE 3.15 would be different, that would be possible. (By the way my reading of documentation also included some 3.18.)
>
> -- David Lee
>
>
> --
> You received this message because you are subscribed to the Google Groups "help-cfengine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/a4a3e96b-4cf5-4e5d-b531-f1504cb18333n%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/B42D3546-51D6-4A3A-B7DB-D1F1FDEA9133%40surf.nl.