Parameterized class development¶
NOTE This feature has been complete and its part of 1.1, the documentation below is inaccurate.
Background¶
Parameterized classes is the notion in puppet of when including a certain class(aka recipe) you could pass specific variables that exists in that class context - very similar to methods / functions arguments.
until puppet version 2.6.something most variables were either global (per catalog compilation per node, so its not really global), or existed in a certain scope, parameterized classes aim to solve that + the ability to extract the variable values from the puppet code itself.
the implementation here breaks into two:
update interface between puppet and foreman¶
Since foreman uses puppet ENC (External Node classifier) interface, we would need to pass the key / value pairs and allow users to decide if they want to keep the existing behavior or the new behavior.
I expect this to be trivial.
Getting the right variables¶
the idea here is to reuse foreman Smart_Variables which already supports all of the complication that is needed in order to resolve the 'right' value to a given system.
This set of tasks can be broken into three
- Add more complex data types (such as hashes and arrays to smartvars).
- Extend smart vars to be optional / mandatory etc.
- Extend the host model and view to assign variables in a simple context (e.g. if a variable to puppet class X could be overwritten per system we could offer the user to override it).
upstream relevant issues
http://theforeman.org/issues/832
http://projects.puppetlabs.com/issues/5045
Contributors¶
Olivier Favre (ofavre) is working on this issue.
Here is his analysis of the resolution.