Skip to content

Instantly share code, notes, and snippets.

@philz
Created March 5, 2009 21:37
Show Gist options
  • Save philz/74566 to your computer and use it in GitHub Desktop.
Save philz/74566 to your computer and use it in GitHub Desktop.
# Make sense of puppet circular dependency error messages.
# Tags: graphviz, puppet
# See output at http://i41.tinypic.com/b6yeqv.jpg
$ cat circular.pp
node default {
exec { "/a": require => Exec["/b"] }
exec { "/b": require => Exec["/c"] }
exec { "/c": require => Exec["/a"] }
}
$ puppet --color=false circular.pp \
| grep "the following relationships: " \
| awk -F"the following relationships: " '{ print $2 }' \
| tr , \\n \
| (echo "digraph {"; perl -pi -e's/^\s*(\S.*\S) => (\S.*\S)\s*$/ "$1" -> "$2";\n/'; echo "}") \
| dot -Tpdf > circular.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment