Actions
User story #6977
closedAdd generic methods to allow convenient data management
Pull Request:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:
Description
There are currently no easy way to manage complex configuration data (such as configuration to be used in template expanding), nor guidelines about file organization (in techniques or shared-files). That can be a problem for techniques with a lot of data, and makes techniques reuse and sharing quite difficult
We should be able to separate policies from data used by the policies, and offer a standard way to manage files and data in techniques created with NCF. This would also allow fetching data from varied sources (local files, remote files, API calls, etc.) For this, we can use the CFEngine data container type which can contain classic structures, JSON (since 3.6) and soon YAML (in 3.7).
Useful generic methods include:- load data from a json local file
- load data from a json answer to an HTTP request
- merge two data variables: override the content of one variable with the content of another
- expand a mustache template from a given data variable (and not from the context)
- define a CFEngine variable (string, int)
- define several data layers, with a defined priority (host-specific -> group-specific data (for example) -> default technique data)
- define a standard application technique using a conventional defaults.json file
- A list of actions (install packages, expand a template, start a service)
- A system configuration (package names, service names) which needs to depend on CFEngine classes, but should probably not need to be modified
- A default application configuration (used as parameter is some configuration actions or variables in template expansion)
- A set of template files
---- - A user application configuration which would override the default
- Maybe more files or template files
Actions