On Thursday, December 3, 2015 at 11:09:47 PM UTC-6, Haani Niyaz wrote:
>
> Thanks for the clarification. I did forget to mention that I tried the 
> ordering of my classes as well:
>
> class { 'server_packages':
>     # list of packages
>     server_packages  => hiera('server_packages'), 
>     enable_repo      => 'my-rpms,base', 
>   } ->
>
> class { 'some_class': 
>    # params here
>   }
>
>

I see no reason to change my earlier remarks, but looking more closely, it 
does appear that you have a containment problem 
<https://docs.puppetlabs.com/puppet/latest/reference/lang_containment.html>.  
Although the evidence is in your log, it would have been more apparent if 
you had given a more complete representation of your Class[some_class].

Note in particular that your log excerpt does not show any resource 
belonging to Class[some_class] applied before Package[mysql-devel.x86_64] 
or any other resource declared by Class[server_packages].  What it shows is 
resources declared by *other* classes (e.g. Class[some_class::Service]) 
being applied in that window.  When one end of a relationship is a class, 
C, the relationship is transitive to the resources declared directly by C, 
but it is *not* automatically transitive to other *classes* declared by C.  
That is, although classes serve as containers for the resources they 
declare, they do not automatically contain the other classes they declare.

That (lack of) class containment behavior is intentional and desirable as a 
default, but often enough you do want classes to contain other classes.  
For that, there is the `contain` function, which provides include-like 
class declarations with containment semantics, and which therefore can be 
used also in addition to another declaration of the same class to add 
containment semantics.  Although the details of your Class[some_class] are 
unclear, you probably want something more or less along these lines:

class some_class (
    # params here
) {
  contain some_class::install
  contain some_class::config
  contain some_class::gem_Install
  contain some_class::service

  Class[some_class::install]
    -> Class[some_class::config]
    -> Class[some_class::gem_install]
    -> Class[some_class::service]
}


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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/d346ca91-8016-4e45-b448-604fb6e1b786%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to