On Monday, February 18, 2013 7:17:51 AM UTC-6, Marc Bolós wrote:
>
> Dear John,
>
> I tryed as you suggested, and didn't work.
>


Well no, evidently you didn't do what I suggested.

 

>
> I Found where is the problem that produces the failure in both cases. The 
> problem basically is that on all the nodes I'm using inherits definition 
> like:
>
> node basenode {
>     include shorewall
>     include othermodules
> }
>
> node examplenode1 inherits basenode {
>     include apache
>     include bind
>     include ssh
> }
>
>

The most essential part of my suggestion was that the "include firewall" be 
parsed *after* "include $service_modules".  The example code achieves that 
by putting the former after the latter in the same node block.  Putting the 
two in different node blocks, with the latter's inheriting from the 
former's, on the other hand, ensures the opposite (i.e. wrong) parse order.

 

> So I tryed debugging and on the template I added following lines:
>
> <% classes.each do |k| -%>
> <%= k %>
> <% end -%>
>
> Then I find that it only prints classes inside basenode:
> shorewall
> other modules
>
>  If I declare host without inherits then, both procedures works, my first 
> and yours. And in this example , classes will print:
> shorewall
> other modules
> apache
> bind
> ssh
>
> It is pretty clear to me that this seems a puppet bug that does not parse 
> properly classes when you are using inherits in site.pp manifets.
>


No bug here.  Puppet is behaving exactly as documented in the failing 
cases.  When Puppet processes your template, the 'apache', 'bind', and 
'ssh' classes have not yet been declared, and therefore they do not appear 
in the 'classes' array.  See 
http://docs.puppetlabs.com/guides/templating.html#access-to-tags-and-declared-classes,
 
which documents the variable you are trying to use.

Even when the classes are all declared in the same node block, I would 
expect that the apache, bind, and ssh 'include's would need to appear 
first.  If you find that not to be the case then you have stumbled on a 
convenience feature.

Now that you have had a taste of the pain, I repeat my initial advice: 
avoid writing DSL code or templates that attempt to inquire whether 
particular resources have been declared.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to