quattor / pan

Pan Language Compiler and Tools
www.quattor.org
Apache License 2.0
13 stars 20 forks source link

include statement should accept list #18

Open loomis opened 11 years ago

loomis commented 11 years ago

Allow the include statement to accept a list of strings. Each should be included according to the standard rules: 1) undef or null does nothing, 2) string causes named template to be included.

jrha commented 9 years ago

:+1:

jouvin commented 8 years ago

:+1:

I came across a use case in the last days for which I found no workaround. For the httpd configuration at LAL, we want to have a basic configuration plus a few optional httpd components that we can combine without the need of defining a boolean to control the inclusion of a specific template. It would be very handy to be able to define the list of templates to include (one per optional component) and let include do whatever is appropriate. This cannot be achieved with an include statement today. And this cannot be done with a structure template either as you want generally to add to some already existing configuration paths (like /software/packages).

loomis commented 8 years ago

This would require changing the pan language grammar to allow a list as a valid argument for an include statement. A separate function would need to be added for the implementation of the include statement variant. In general, this shouldn't be to difficult to implement, although the implementation will have to be careful to check all of the arguments for validity.