# Revision history [back]

In blabla.erb, you can use the scope.lookupvar() function call or scope[] array to check to see if $::myclass::feature1::myvar and$::myclass::feature2::myvar are defined, and if so take an action based on that information. See: https://docs.puppetlabs.com/guides/templating.html#out-of-scope-variables

With this approach, you need to make sure that myclass::feature1 and myclass::feature2 are included into your catalog before ::myclass so that those variables are defined when blabla.erb is rendered.

The approach you are using isn't very clean, and is going to be extremely difficult to maintain in the long run. I'd recommend instead that you use puppetlabs/concat to build the file from fragments.

With the fragment approach, you can define a header and tail that will always be included. ::myclass::feature1 and ::myclass::feature2 can insert their own file fragments on the condition they have been included in the catalog. This approach is much more standard and flexible.

Ideally, whatever ::myclass manages supports config.d style config directories, and concat isn't needed at all.

In blabla.erb, you can use the scope.lookupvar() function call or scope[] array to check to see if $::myclass::feature1::myvar and$::myclass::feature2::myvar are defined, and if so take an action based on that information. See: https://docs.puppetlabs.com/guides/templating.html#out-of-scope-variableshttps://docs.puppetlabs.com/guides/templating.html#out-of-scope-variables