Hi Gareth,
> On 31 Oct 2016, at 17:10, Anfield <gareth.has...@gmail.com> wrote:
> 
> Can anyone explain what puppet contain function does for classes? Cant seem 
> to grasp this concept.

contain adds a class to the catalog (similar to what include does).
But contain handles the way where the class gets added.

Think about the following code:

class a {
  include c
}
class b {
  include c
}

node default {
  include a
  include b
  Class[‘a’] -> Class[‘b’]
}

When does class c gets added to the catalog?
Class a and b are put into order. But class c is not added at a specific place 
in the catalog.

This is where contain comes into place:

class a {
  contain c
}
class b {
 include c
}

node default {
  include a
  include b
  Class[‘a’] -> Class[‘b’]
}

In this case the contain function ensures that the class c is added within 
class a.

hth,
Martin

-- 
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/75641F96-60B8-450A-B6FD-DA7FE42775CD%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to