The augments file (def.json) facility has been very popular with new users and this proposal extends it to be more friendly with multiple external data sources.
Pull Request: https://github.com/cfengine/core/pull/2515
Really simple logic currently:
- augments key contents (which must be an array of strings) are loaded.
- System variables like sys.inputdir are expanded (see acceptance test).
- vars and classes are merged because they are processed one by one
- inputs override other inputs
It would be nice if each additional augments could be defined with its own merge strategy.
An entry could be of the form
Allowing the following where sys.flavor.json is merged with the default strategy and the host-specific augments is merged deeply to extend the data instead of overwriting it.
Here is an example of the extension so that after loading def.json we merge it with a flavor specific augments, followed by a host-specific augments.
Here is an example showing how vars would be merged using the above augments specification on a Centos 6 host.
Expected merged result after expansion:
And here are the expected variable values: