no i would want to create a custom template_data container
which below one key has the classes defined in def.json (and by cf-
agent from the environment)
and via other keys a number of variables (variables defined by the
current agent.)
This is basically compared with the normal built in template data
getting rid of having to nominate containing namespace for a class in
the mustache template.
I would like to have something like this:
---
vars:
"klassamling"
slist => classes_matching( ".*", "source=augment", "WiFi");
"templatedata"
data => mergedata( '{ "klasser": klassamling,
"testvar": "22"
}');
files:
"test"
edit_template= "test.mustache",
template_data => templatedata,
template_method => "mustache";
--
test.mustache:
---
{{#klasser.is_kdc_hub}}
variabel = {{testvar}}
{{/klasser.is_kdc_hub}}
---
For this to work if i understand mustache correctly would really mean
having some method of going from a string to a key in "klasser" where
the key's value is true ?
ONE another method would be to call datastate early on in my policy,
pull out the classes tree only and when if some agent wants access,
they can do so using the container's path - ie:
services/
main.cf:
---
"datastate"
data => datastate();
"klasser"
data => mergedata( datastate[classes]);
---
And from other agent refer to klasser :
---
"template_data"
data => mergedata( '{ "klasser": default:main.klasser,
"var2": 3,
"var3": 4
}');
---
That agent is in another namespace, for example "WiFi".
My idea is to being able to tell a developer which wants to control
some type of text config file : refer to classes and vars using a
short name (and not having to tell/educate them about the concept of
namespaces in cfengine.)
A lot of complexity .... to be able to say :
----
test = {{test}}
{{#iftest}}
test2 = {{test2}}
{{/iftest}}
---
Instead of :
---
test = {{vars.DNS:agentName.test}}
{{#classes.DNS:iftest}}
test2 = {{vars.DNS:agentName.test2}}
{{/classes.DNS:iftest}}
----