Book Image

LEARNING PUPPET

Book Image

LEARNING PUPPET

Overview of this book

Table of Contents (17 chapters)
Learning Puppet
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting around dependency cycle errors


Resource ordering is a very handy feature of Puppet, but it can sometimes cause so much grey hair. A resource order can be set in the resource with attributes, such as before, require, notify, and subscribe. Or to set the order outside the resource, we can use the arrow notations such as -> (a hyphen and a greater than sign for before) or ~> (a tilde and a greater than sign for notify).

When a resource ordering chain grows long, and we have dependencies between resources that are declared in various different manifest files and modules, the chance of a dependency cycle error increases.

Here is an example of an error message that is caused by the dependency cycle error:

The preceding error message shows a list of dependent resources separated by => sign. The message shows that the Exec['/tmp/script1.sh'] resource depends on the Exec['/tmp/script2.sh'] resource, which has a dependency back to the Exec['/tmp/script1.sh'] resource.

Let's take a look...