Catalogue graph building; nodes *then* edges?

32 views
Skip to first unread message

Ken Coar

unread,
Nov 8, 2013, 2:18:04 PM11/8/13
to puppet...@googlegroups.com
Puppet 2.7 (primarily; soon going to 3).

When a host's catalogue is built, Puppet collects all
the graph nodes first, correct?  And *then* adds the
dependency edges between them?

Why do I ask?  Because I keep coming up against a desire
for one class to know whether another one is in the
catalogue before it declares a dependency relationship.
defined() doesn't cut it, since the class in question may not
have been scanned yet.

If it's collect *then* connect, I'll be adding a FREQ for
a function (or other means) to access/check the collection
prior to the connexion phase..
-- Ken Coar Sanagendamgagwedweinini

jcbollinger

unread,
Nov 11, 2013, 9:44:35 AM11/11/13
to puppet...@googlegroups.com


You are wise to avoid defined() here, but I think you would be wiser still to give up the whole idea of testing the catalog under construction to guide decisions about what (other) resources need to be declared.  It is always possible to write your configuration such, though some manifest set architectures may lend themselves better to that than do others.

If you have a resource A that you want to declare only if resource B is also declared, then the key is to pull up the logic controlling B's declaration to encompass the scope of A's declaration as well (which may be subject to additional conditions).  The "roles and profiles" pattern is well suited to this sort of arrangement, though you can surely find other viable approaches as well.


John

Ken Coar

unread,
Nov 11, 2013, 3:03:40 PM11/11/13
to puppet...@googlegroups.com
Unfortunately, we have many dozen modules and hundreds of classes, with a disjoint set of people using and maintaining them.  What you suggest simply isn't practical. :-(  Asking the human element to keep track of what relevant changes have been made, and alter scripts accordingly, is not only error-prone but the sort of thing computers are supposed to do for us..

Thanks, though!


Reply all
Reply to author
Forward
0 new messages