Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a class in puppet if I have the following code:

class A {
  require B

....
} 

I get circular dependencies error. If I have:

class A {
  include B

....
} 

everything works fine

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

They are very different things, actually. To say require B means A must come before B (and, therefore, can lead to circular dependencies if something in B turns out to require A). And if B is not included at all, it will lead to missing dependencies error.

On the other hand, include B just says B will be applied whenever A gets applied: it says nothing of the order between them.

share|improve this answer
add comment

This was just asked (and answered) on the puppet mailing list:

The difference is evident when the catalog needs to be applied. With include you have evaluated its contents at the time of the include - but any resources must be depended on explicitly after the include. With a require - the dependency is created for you - but you have to be careful and ensure that this is your desired result

- Ken Barber in Require vs Include?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.