Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

composition nodes of the parts of the module

hi there

I want to describe the module in the node "solve" any part of this module will "work":

class myclass {
   service {...}
   file {... content => template (blabla.erb), ...}
   package {...}
}

class myclass :: feature1 {
   $ myVar = ['add this line', 'and second']
}

class myclass :: feature2 {
   $ myVar = ['this feature enabled']
}

#FeatureX these can be any number, and it would be good to them then it was easy to add

A description of the host may include different parts of the module

node "mynode" {
...
   include myclass :: feature1
   include myclass :: feature2
   include myclass
...
}

blabla.erb looks like this:

...
    <% if myVar%> <% @ myVar.each do | var | -%> <% = var%>
    <% end -%> <% end%>
...

this does not work, because the variable myVar described in myclass :: feature is local and is not visible in the generation templat'a =( ... if i definition var in node i loose encapsulation

please tell me how to do it?

thank you