Ask Your Question

About Puppet Class Dependencies

asked 2013-08-19 14:54:35 -0600

louis gravatar image

Having the following modules/classes...

module A

class A{
  include A::install, include A::configure
  Class['A::install'] -> Class['A::configure'] 

class A::install{
  ..some resources here

class A::configure{
 ... some resources here

module B

class B {
  require A

Based on the documentation. B should enforce the dependency on the A class before executing ANYTHING on B right? or doing the the same thing with another syntax...

module B

    class B{
     include A

     ...whole bunch of resources


Since i want to get rid of the following code like resources:

 require => Class['A']

It seems that ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-19 20:09:57 -0600

"Classes do not get contained by the class or defined type that declares them."

This is a known design problem in Puppet. Simple resources (eg. file or package) do get included in the correct order because they are contained. However, the same idea of containment doesn't apply to classes because you can include them in more than one place.

Luckily, there is a workaround called the Anchor Pattern. By modifying a contained resource so that is has an explicit require relationship with the classes you want to include ... (more)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-08-19 14:54:35 -0600

Seen: 13,889 times

Last updated: Aug 19 '13