On Thursday, September 20, 2012 4:06:15 AM UTC-5, Jones wrote:
Hi folks,
has my puppet nuts?
It worked perfectly. It's too bad that we don't have monday... that would explain everything :D
example:
"PermitRootLogin": value => "no",
notify => Service['ssh'],
Am I stupid?
Unlikely.
I take it that catalog compilation fails with a message such as the subject of this thread? That would indicate that no declaration of Service['ssh'] has yet been parsed at the point where the implicated code is being parsed. There are two basic possibilities:
- Service['ssh'] is in fact not declared anywhere for the affected node. Perhaps conditional statements inadvertently prevent such a declaration, or inadvertently trigger the sshd_config declaration on a node that shouldn't have it.
- Service['ssh'] is declared for the affected node, but that declaration has not yet been parsed. Application-order relationships such as those declared via the 'notify' metaparameter do not affect parse order (and indeed they can't, because there's no reliable way to predict which manifest contains any given declaration).
Your problem is most likely in category (2). Note that even if you don't modify the classes containing your ssh declarations, the order in which they are parsed can be affected by changes elsewhere.
I can't make much in the way of specific suggestions without actual code (what you posted is both incomplete and invalid), but there are really only two ways to control parse order:
- Declarations in the same scope (class, node, or global) are parsed in the order they are written
- The 'include' (or 'require') function, or a parametrized-style class declaration, ensures that the named class has been parsed before any declarations appearing later in the same scope
Generally speaking, you should avoid parametrizing your classes, and use 'include' at the beginning of each class's body to declare its dependencies. 'Include'ing the same class multiple times (i.e. from different classes) is not a problem so long as the class is not parametrized.
For resources in the same class, just be sure to declare each resource after the declarations of all other resources on which it depends.
John